For the POSIX OS vos implementation, the proposal is to use the protocol PTHREAD_PRIO_INHERIT during the creation of the mutexes.
When a thread is blocking higher priority threads because of owning one or more mutexes with the PTHREAD_PRIO_INHERIT protocol attribute, it shall execute at the higher of its priority or the priority of the highest priority thread waiting on any of the mutexes owned by this thread and initialized with this protocol.
This would ensure that the higher priority task is kept in the blocked state for the shortest time possible, and in doing so minimize the 'priority inversion' that has already occurred.
If needed, this could also be kept as a compilation-flag controlled option, so that it comes into effect only if the integrator explicitly enables this flag.
Diff:
Hi Chirag,
please to the requested change in the source code. A new compiler flag is not necessary.
Best regards
Armin
Code updated in commit r2343