summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2017-03-27 20:31:03 +0000
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2017-03-27 20:31:03 +0000
commita27b7a66abf9ab509a61fa64aa2626d39cfe447a (patch)
tree4600c1808d9eeb72907f94401dec933627a5533f
parentf62e2fab204bfcde3724f3d55070b02a7a641b38 (diff)
downloadfreertos-a27b7a66abf9ab509a61fa64aa2626d39cfe447a.tar.gz
Ensure vTaskGetInfo() sets the sate of the currently running task to eRunning - previously it was set to eReady.
git-svn-id: http://svn.code.sf.net/p/freertos/code/trunk@2491 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
-rw-r--r--FreeRTOS/Source/tasks.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c
index 76abb9e7c..460f4bf3c 100644
--- a/FreeRTOS/Source/tasks.c
+++ b/FreeRTOS/Source/tasks.c
@@ -3555,25 +3555,6 @@ static void prvCheckTasksWaitingTermination( void )
pxTaskStatus->pxStackBase = pxTCB->pxStack;
pxTaskStatus->xTaskNumber = pxTCB->uxTCBNumber;
- #if ( INCLUDE_vTaskSuspend == 1 )
- {
- /* If the task is in the suspended list then there is a chance it is
- actually just blocked indefinitely - so really it should be reported as
- being in the Blocked state. */
- if( pxTaskStatus->eCurrentState == eSuspended )
- {
- vTaskSuspendAll();
- {
- if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )
- {
- pxTaskStatus->eCurrentState = eBlocked;
- }
- }
- ( void ) xTaskResumeAll();
- }
- }
- #endif /* INCLUDE_vTaskSuspend */
-
#if ( configUSE_MUTEXES == 1 )
{
pxTaskStatus->uxBasePriority = pxTCB->uxBasePriority;
@@ -3594,12 +3575,38 @@ static void prvCheckTasksWaitingTermination( void )
}
#endif
- /* Obtaining the task state is a little fiddly, so is only done if the value
- of eState passed into this function is eInvalid - otherwise the state is
- just set to whatever is passed in. */
+ /* Obtaining the task state is a little fiddly, so is only done if the
+ value of eState passed into this function is eInvalid - otherwise the
+ state is just set to whatever is passed in. */
if( eState != eInvalid )
{
- pxTaskStatus->eCurrentState = eState;
+ if( pxTCB == pxCurrentTCB )
+ {
+ pxTaskStatus->eCurrentState = eRunning;
+ }
+ else
+ {
+ pxTaskStatus->eCurrentState = eState;
+
+ #if ( INCLUDE_vTaskSuspend == 1 )
+ {
+ /* If the task is in the suspended list then there is a
+ chance it is actually just blocked indefinitely - so really
+ it should be reported as being in the Blocked state. */
+ if( eState == eSuspended )
+ {
+ vTaskSuspendAll();
+ {
+ if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )
+ {
+ pxTaskStatus->eCurrentState = eBlocked;
+ }
+ }
+ ( void ) xTaskResumeAll();
+ }
+ }
+ #endif /* INCLUDE_vTaskSuspend */
+ }
}
else
{