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.
int futex_init(futex_t *restrict futex)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.
typedef futex_t mutex_tint futex_destroy(futex_t *futex)int futex_lock(futex_t *futex)int futex_unlock(futex_t *futex)int futex_trylock(futex_t *futex)MUTEX_INITIALIZEDFUTEX_STATIC_INITIf futex is initialized using this value, then it is not necessary to call futex_init()
FUTEX_SUCCESSFUTEX_FAILURE