Hi.
In the function xTaskPriorityDisinherit there is the following check:
/* Only disinherit if no other mutexes are held. */
if( pxTCB->uxMutexesHeld == ( UBaseType_t ) 0 )
Why does the task not disinherit priority when other mutexes are held? The other mutexes might have a lower priority than the current one, but still higher than uxBasePriority.
This is a simplification in the priority inheritance implementation done
in the interest of simplicity. A full priority inheritance
implementation is complex due to the number of scenarios (there are many
combinations of the order in which tasks of various priority can take
and release semaphores) and thus results in a lot of additional code and
data space requirements for scenarios that almost never occur - hence we
opted to implement this simplification.
Thanks for the reply. Is there any write up on the alternative, full priority inheritance implementation? And the different situations that are handled or unhandled?
Because at first sight (actually quite many read through) of the code, it seems possible add full support in very few lines of code. First remove the line in my first post, then add lines that set pxTCB->uxPriority to the highest priority of any task that is blocked by other held mutexes, or to pxTCB->uxBasePriority if no tasks of higher priority is blocked.
Would there be any implications of this proposal?
Best regards.
Well, it could be done by changing uxMutexesHeld to a (linked) list of held mutexes. Then for each mutex in uxMutexesHeld in xTaskPriorityDisinherit do something like: