Skip to content

Commit

Permalink
Fix eTaskGetState for pending ready tasks (#679)
Browse files Browse the repository at this point in the history
This commit fixes eTaskGetState so that eReady is returned for pending ready
tasks.

Co-authored-by: Darian Leung <[email protected]>
  • Loading branch information
aggarg and Dazza0 authored May 25, 2023
1 parent 97434a4 commit 953c1ee
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
{
eTaskState eReturn;
List_t const * pxStateList;
List_t const * pxEventList;
List_t const * pxDelayedList;
List_t const * pxOverflowedDelayedList;
const TCB_t * const pxTCB = xTask;
Expand All @@ -1367,12 +1368,20 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
taskENTER_CRITICAL();
{
pxStateList = listLIST_ITEM_CONTAINER( &( pxTCB->xStateListItem ) );
pxEventList = listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) );
pxDelayedList = pxDelayedTaskList;
pxOverflowedDelayedList = pxOverflowDelayedTaskList;
}
taskEXIT_CRITICAL();

if( ( pxStateList == pxDelayedList ) || ( pxStateList == pxOverflowedDelayedList ) )
if( pxEventList == &xPendingReadyList )
{
/* The task has been placed on the pending ready list, so its
* state is eReady regardless of what list the task's state list
* item is currently placed on. */
eReturn = eReady;
}
else if( ( pxStateList == pxDelayedList ) || ( pxStateList == pxOverflowedDelayedList ) )
{
/* The task being queried is referenced from one of the Blocked
* lists. */
Expand Down

0 comments on commit 953c1ee

Please sign in to comment.