4.3.3 Mutex

A mutex is a lot like a binary semaphore, but in addition, it provides a priority inheritance mechanism. If a high priority task gets blocked from accessing a resource that is already taken by a lower priority task, the lower priority task will inherit the priority of the high priority task until it has released the mutex. This ensures that the blocking time of the high priority task is minimized since the low priority task now cannot be preempted by other medium priority tasks.

A mutex is created by using the semaphoreHandle_t mutexName = xSemaphoreCreateMutex(void) function.

Mutexes should not be used from an interrupt because the priority inheritance mechanism only makes sense for a task, and not for an interrupt.