C Microkernel Realtime eXecutive
Realtime Operating System for Cortex-M based microcontrollers
 
Loading...
Searching...
No Matches

Description

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.

Data Structures

struct  futex_t
 Futex structure. More...
 

Macros

#define MUTEX_INITIALIZED   1
 
#define FUTEX_STATIC_INIT   { 0xFF, 0, 0 }
 Compile time initialization of futex.
 

Typedefs

typedef futex_t mutex_t
 

Functions

int futex_destroy (futex_t *futex)
 
int futex_lock (futex_t *futex)
 
int futex_unlock (futex_t *futex)
 
int futex_trylock (futex_t *futex)
 
__SYSCALL int mutex_init (mutex_t *restrict mutex)
 Mutexes Mutexes are fully features inter-process locking primitive.
 
__SYSCALL int mutex_destroy (mutex_t *mutex)
 
__SYSCALL int mutex_lock (mutex_t *mutex)
 
__SYSCALL int mutex_unlock (mutex_t *mutex)
 
__SYSCALL int mutex_trylock (mutex_t *mutex)
 
int futex_init (futex_t *restrict futex)
 Futexes Futex is fast userspace mutex.
 

Macro Definition Documentation

◆ 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

Typedef Documentation

◆ mutex_t

typedef futex_t mutex_t

Function Documentation

◆ 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()

int futex_lock ( futex_t futex)

◆ futex_trylock()

int futex_trylock ( futex_t futex)

◆ futex_unlock()

int futex_unlock ( futex_t futex)

◆ mutex_destroy()

__SYSCALL int mutex_destroy ( mutex_t mutex)

◆ mutex_init()

__SYSCALL int mutex_init ( mutex_t *restrict  mutex)

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()

__SYSCALL int mutex_lock ( mutex_t mutex)

◆ mutex_trylock()

__SYSCALL int mutex_trylock ( mutex_t mutex)

◆ mutex_unlock()

__SYSCALL int mutex_unlock ( mutex_t mutex)