pxTaskStatus->pxStackBase = pxTCB->pxStack;\r
pxTaskStatus->xTaskNumber = pxTCB->uxTCBNumber;\r
\r
- #if ( INCLUDE_vTaskSuspend == 1 )\r
- {\r
- /* If the task is in the suspended list then there is a chance it is\r
- actually just blocked indefinitely - so really it should be reported as\r
- being in the Blocked state. */\r
- if( pxTaskStatus->eCurrentState == eSuspended )\r
- {\r
- vTaskSuspendAll();\r
- {\r
- if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )\r
- {\r
- pxTaskStatus->eCurrentState = eBlocked;\r
- }\r
- }\r
- ( void ) xTaskResumeAll();\r
- }\r
- }\r
- #endif /* INCLUDE_vTaskSuspend */\r
-\r
#if ( configUSE_MUTEXES == 1 )\r
{\r
pxTaskStatus->uxBasePriority = pxTCB->uxBasePriority;\r
}\r
#endif\r
\r
- /* Obtaining the task state is a little fiddly, so is only done if the value\r
- of eState passed into this function is eInvalid - otherwise the state is\r
- just set to whatever is passed in. */\r
+ /* Obtaining the task state is a little fiddly, so is only done if the\r
+ value of eState passed into this function is eInvalid - otherwise the\r
+ state is just set to whatever is passed in. */\r
if( eState != eInvalid )\r
{\r
- pxTaskStatus->eCurrentState = eState;\r
+ if( pxTCB == pxCurrentTCB )\r
+ {\r
+ pxTaskStatus->eCurrentState = eRunning;\r
+ }\r
+ else\r
+ {\r
+ pxTaskStatus->eCurrentState = eState;\r
+\r
+ #if ( INCLUDE_vTaskSuspend == 1 )\r
+ {\r
+ /* If the task is in the suspended list then there is a\r
+ chance it is actually just blocked indefinitely - so really\r
+ it should be reported as being in the Blocked state. */\r
+ if( eState == eSuspended )\r
+ {\r
+ vTaskSuspendAll();\r
+ {\r
+ if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )\r
+ {\r
+ pxTaskStatus->eCurrentState = eBlocked;\r
+ }\r
+ }\r
+ ( void ) xTaskResumeAll();\r
+ }\r
+ }\r
+ #endif /* INCLUDE_vTaskSuspend */\r
+ }\r
}\r
else\r
{\r