Eventlist is sorted by ascending task’s priority order, so lower priority task is in the front of the list and higher priority tasks is in the back of the list.
but in xTaskRemoveFromEventList(),
at line 1287 in tasks.c , there is
pxUnblockedTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );
vListRemove( &( pxUnblockedTCB->xEventListItem ) );
from these code, we know we are glad to get the head of the list ---- remove the lowest task from the pxEventList. In common, this is not very effective, we should try out best to assure high priority task to use more system resource.
So when we remove a task from the pxEventList , we should always remove the highest priority task firstly, i think.
we can solve this problem by this:
(at line 1421 in task.c prvInitialiseTCBVariables() )
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( portTickType ) uxPriority );
====changed to ====>>>
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) uxPriority );