In vTaskDelete function, we suppose remove task from ready list. But actually, maybe we delete a task already in suspend list or delayed list. At this time, we maybe reset task priority by mistake
For example, we have 2 tasks in same priority, and one of them in suspend list(by vTaskSuspend function), and we suppose just this one task in suspend list. If we delete this task in suspend list, we maybe reset this priority by mistake
The name of this macrro is a bit misleading - As mentioned in the definition of the taskRESET_READY_PRIORITY
, the actual priority reset is done only if the task being deleted is on the ready list.
/* A port optimised version is provided, call it only if the TCB being reset
is being referenced from a ready list. If it is referenced from a delayed
or suspended list then it won't be in a ready list. */
#define taskRESET_READY_PRIORITY( uxPriority ) \
{ \
if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ ( uxPriority ) ] ) ) == ( UBaseType_t ) 0 ) \
{ \
portRESET_READY_PRIORITY( ( uxPriority ), ( uxTopReadyPriority ) ); \
} \
}
Thanks.
Thanks very much for your help