Ensure vTaskGetInfo() sets the sate of the currently running task to eRunning - previously it was set to eReady.

This commit is contained in:
Richard Barry 2017-03-27 20:31:03 +00:00
parent 3b2bbcb56a
commit aa810cb926

View file

@ -3555,25 +3555,6 @@ static void prvCheckTasksWaitingTermination( void )
pxTaskStatus->pxStackBase = pxTCB->pxStack; pxTaskStatus->pxStackBase = pxTCB->pxStack;
pxTaskStatus->xTaskNumber = pxTCB->uxTCBNumber; 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 ) #if ( configUSE_MUTEXES == 1 )
{ {
pxTaskStatus->uxBasePriority = pxTCB->uxBasePriority; pxTaskStatus->uxBasePriority = pxTCB->uxBasePriority;
@ -3594,12 +3575,38 @@ static void prvCheckTasksWaitingTermination( void )
} }
#endif #endif
/* Obtaining the task state is a little fiddly, so is only done if the value /* Obtaining the task state is a little fiddly, so is only done if the
of eState passed into this function is eInvalid - otherwise the state is value of eState passed into this function is eInvalid - otherwise the
just set to whatever is passed in. */ state is just set to whatever is passed in. */
if( eState != eInvalid ) if( eState != eInvalid )
{
if( pxTCB == pxCurrentTCB )
{
pxTaskStatus->eCurrentState = eRunning;
}
else
{ {
pxTaskStatus->eCurrentState = eState; 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 else
{ {