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

Basic synchronization primitives for use inside one process. More...

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.
 
#define FUTEX_SUCCESS   0
 
#define FUTEX_FAILURE   1
 

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)
 

Detailed Description

Basic synchronization primitives for use inside one process.

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.

Macro Definition Documentation

◆ FUTEX_FAILURE

#define FUTEX_FAILURE   1

◆ 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.

◆ FUTEX_SUCCESS

#define FUTEX_SUCCESS   0

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