From f99a78833622e5b10366f9c91c3fa459e8fb3723 Mon Sep 17 00:00:00 2001 From: Paul Bartell Date: Wed, 24 Mar 2021 13:07:12 -0700 Subject: [PATCH] Clarify list usage in xTaskRemoveFromEventList --- tasks.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tasks.c b/tasks.c index 729404cb0..c7ffdcff1 100644 --- a/tasks.c +++ b/tasks.c @@ -3092,8 +3092,15 @@ void vTaskPlaceOnEventList( List_t * const pxEventList, /* Place the event list item of the TCB in the appropriate event list. * This is placed in the list in priority order so the highest priority task - * is the first to be woken by the event. The queue that contains the event - * list is locked, preventing simultaneous access from interrupts. */ + * is the first to be woken by the event. + * + * Note: Lists are sorted in ascending order by ListItem_t.xItemValue. + * Normally, the xItemValue of a TCB's ListItem_t members is: + * xItemValue = ( configMAX_PRIORITIES - uxPriority ) + * Therefore, the event list is sorted in descending priority order. + * + * The queue that contains the event list is locked, preventing + * simultaneous access from interrupts. */ vListInsert( pxEventList, &( pxCurrentTCB->xEventListItem ) ); prvAddCurrentTaskToDelayedList( xTicksToWait, pdTRUE );