Mutex robustness. More...
#include <cmsis-plus/rtos/os.h>
Public Types | |
enum | : robustness_t { stalled = 0 , robust = 1 , default_ = stalled , max_ = robust } |
Enumeration of mutex robustness. More... | |
Mutex robustness.
Allow to define the behaviour when the thread owning a mutex terminates.
The mutex robustness is defined via the mx_robustness
attribute of the mutex::attributes
class. Valid values are:
No special actions are taken if the owner of the mutex is terminated while holding the mutex lock. This can lead to deadlocks if no other thread can unlock the mutex. This is the default value.
If the owning thread of a robust mutex terminates while holding the mutex lock, the next thread that acquires the mutex may be notified about the termination by the return value EOWNERDEAD
. The notified thread can then attempt to mark the state protected by the mutex as consistent again by a call to mutex::consistent()
. After a subsequent successful call to mutex::unlock()
, the mutex lock shall be released and can be used normally by other threads. If the mutex is unlocked without a call to mutex::consistent()
, it shall be in a permanently unusable state and all attempts to lock the mutex shall fail with the error ENOTRECOVERABLE
. The only permissible operations on such a mutex are mutex::reset()
and the mutex destruction.
pthread_mutexattr_setrobust()
from <pthread.h>
(IEEE Std 1003.1, 2013 Edition). Definition at line 113 of file os-mutex.h.
anonymous enum : robustness_t |
Enumeration of mutex robustness.
Enumerator | |
---|---|
stalled | Normal robustness. |
robust | Enhanced robustness at thread termination. |
default_ | Default value. |
max_ | Maximum value, for validation purposes. |
Definition at line 118 of file os-mutex.h.