From 77ec05e641ab602004aaa7b6e7118df8a78f4d2e Mon Sep 17 00:00:00 2001 From: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Date: Mon, 10 Jul 2023 14:29:38 +0800 Subject: [PATCH] Update uxTaskGetSystemState for tasks in pending ready list (#702) * Update uxTaskGetSystemState to sync with eTaskGetState * Update in vTaskGetInfo for tasks in pending ready list should be in ready state. --- tasks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tasks.c b/tasks.c index e2861dd94aa..ed3cd1ee2ed 100644 --- a/tasks.c +++ b/tasks.c @@ -3843,6 +3843,18 @@ static void prvCheckTasksWaitingTermination( void ) } } #endif /* INCLUDE_vTaskSuspend */ + + /* Tasks can be in pending ready list and other state list at the + * same time. These tasks are in ready state no matter what state + * list the task is in. */ + taskENTER_CRITICAL(); + { + if( listIS_CONTAINED_WITHIN( &xPendingReadyList, &( pxTCB->xEventListItem ) ) != pdFALSE ) + { + pxTaskStatus->eCurrentState = eReady; + } + } + taskEXIT_CRITICAL(); } } else