CMRX offers mutual exclusive access facilities for userspace processes.
There is an implementation of futex (fast userspace mutex) available and supported. There is also an implementation of mutex (driven by kernel), but this might get deprecated anytime soon.
◆ FUTEX_STATIC_INIT
#define FUTEX_STATIC_INIT { 0xFF, 0, 0 } |
Compile time initialization of futex.
If futex is initialized using this value, then it is not necessary to call futex_init() during runtime.
◆ MUTEX_INITIALIZED
#define MUTEX_INITIALIZED 1 |
◆ mutex_t
◆ futex_destroy()
int futex_destroy |
( |
futex_t * |
futex | ) |
|
◆ futex_init()
int futex_init |
( |
futex_t *restrict |
futex | ) |
|
Futexes Futex is fast userspace mutex.
Advantage of futex over mutex is, that it can be locked and unlocked completely from userspace. Futexes can be shared safely between threads of single process, yet can't be normally shared between threads of multiple processes unless explicitly placed into shared memory region.
◆ futex_lock()
◆ futex_trylock()
int futex_trylock |
( |
futex_t * |
futex | ) |
|
◆ futex_unlock()
int futex_unlock |
( |
futex_t * |
futex | ) |
|
◆ mutex_destroy()
◆ mutex_init()
Mutexes Mutexes are fully features inter-process locking primitive.
They are implemented as kernel system calls, so they are bit heavier to use than futexes. On the other hand, they can be shared accross processes.
◆ mutex_lock()
◆ mutex_trylock()
◆ mutex_unlock()