Blocking Mutex of the QXK preemptive kernel. More...
Blocking Mutex of the QXK preemptive kernel.
QXMutex is a blocking mutual exclusion mechanism that can also apply the priority-ceiling protocol to avoid unbounded priority inversion (if initialized with a non-zero ceiling priority, see QXMutex_init()). In that case, QXMutex requires its own unique QP priority level, which cannot be used by any thread or any other QXMutex.
If initialized with preemption-ceiling of zero, QXMutex does not use the priority-ceiling protocol and does not require a unique QP priority (see QXMutex_init()).
QXMutex is recursive (re-entrant), which means that it can be locked multiple times (up to 255 levels) by the same thread without causing deadlock.
QXMutex is primarily intended for the extended (blocking) threads, but can also be used by the basic threads through the non-blocking QXMutex_tryLock() API.
The following example illustrates how to instantiate and use the mutex to protect a shared resource (random seed of a pseudo-random number generator).