In API vTaskPrioritySet:
#if ( configUSE_MUTEXES == 1 )
{
/* Only change the priority being used if the task is not
currently using an inherited priority. */
if( pxTCB->uxBasePriority == pxTCB->uxPriority )
{
pxTCB->uxPriority = uxNewPriority;
}
else
{
mtCOVERAGE_TEST_MARKER();
}
/* The base priority gets set whatever. */
pxTCB->uxBasePriority = uxNewPriority;
}
#else
......
I noticed that once priority inheritance occurs, uxPriority will not be set. My question is: If the priority set by vTaskPrioritySet is higher than the inherited priority, why not use the higher one?
like this:
if( pxTCB->uxBasePriority == pxTCB->uxPriority || uxNewPriority > pxTCB->uxPriority )
{
pxTCB->uxPriority = uxNewPriority;
}
Otherwise, the priority set by vTaskPrioritySet will not take effect until the disinheritance occurs.