Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FreeRTOS/FreeRTOS-Kernel.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoral-Hao <sihunzhilei@126.com>2023-11-07 10:33:07 +0300
committerGitHub <noreply@github.com>2023-11-07 10:33:07 +0300
commit0640b2e4863bfdf628406cc90e29200a9220e088 (patch)
treea985317ad86d3a7b3feda46a56a2dd9f1323c3c2 /tasks.c
parent8ede50cafd8279f0aff1da59d6d1b89a1fa5c2c3 (diff)
Distinguish waiting for notify status from suspend status (#865)
* Fix prvTaskIsTaskSuspended. Just like eTaskGetState, distinguish waiting for notify from suspend. * Fix vTaskGetInfo. Just like eTaskGetState, distinguish block state (waiting on notification) from suspend state. * Add missing definition of variable x. * Fix formatting syntax. --------- Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> Co-authored-by: Tony Josi <tonyjosi@amazon.com>
Diffstat (limited to 'tasks.c')
-rw-r--r--tasks.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/tasks.c b/tasks.c
index 75dded41f..5500bf435 100644
--- a/tasks.c
+++ b/tasks.c
@@ -3284,10 +3284,34 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
if( listIS_CONTAINED_WITHIN( &xPendingReadyList, &( pxTCB->xEventListItem ) ) == pdFALSE )
{
/* Is it in the suspended list because it is in the Suspended
- * state, or because is is blocked with no timeout? */
+ * state, or because it is blocked with no timeout? */
if( listIS_CONTAINED_WITHIN( NULL, &( pxTCB->xEventListItem ) ) != pdFALSE ) /*lint !e961. The cast is only redundant when NULL is used. */
{
- xReturn = pdTRUE;
+ #if ( configUSE_TASK_NOTIFICATIONS == 1 )
+ {
+ BaseType_t x;
+
+ /* The task does not appear on the event list item of
+ * and of the RTOS objects, but could still be in the
+ * blocked state if it is waiting on its notification
+ * rather than waiting on an object. If not, is
+ * suspended. */
+ xReturn = pdTRUE;
+
+ for( x = ( BaseType_t ) 0; x < ( BaseType_t ) configTASK_NOTIFICATION_ARRAY_ENTRIES; x++ )
+ {
+ if( pxTCB->ucNotifyState[ x ] == taskWAITING_NOTIFICATION )
+ {
+ xReturn = pdFALSE;
+ break;
+ }
+ }
+ }
+ #else /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
+ {
+ xReturn = pdTRUE;
+ }
+ #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
}
else
{
@@ -6131,6 +6155,24 @@ static void prvCheckTasksWaitingTermination( void )
{
pxTaskStatus->eCurrentState = eBlocked;
}
+ else
+ {
+ BaseType_t x;
+
+ /* The task does not appear on the event list item of
+ * and of the RTOS objects, but could still be in the
+ * blocked state if it is waiting on its notification
+ * rather than waiting on an object. If not, is
+ * suspended. */
+ for( x = ( BaseType_t ) 0; x < ( BaseType_t ) configTASK_NOTIFICATION_ARRAY_ENTRIES; x++ )
+ {
+ if( pxTCB->ucNotifyState[ x ] == taskWAITING_NOTIFICATION )
+ {
+ pxTaskStatus->eCurrentState = eBlocked;
+ break;
+ }
+ }
+ }
}
( void ) xTaskResumeAll();
}