PatchworkOS
Loading...
Searching...
No Matches
Fast User-space Mutex

Fast User-space Mutex. More...

Data Structures

struct  futex_t
 Futex structure. More...
 
struct  futex_ctx_t
 Per-process futex context. More...
 

Functions

void futex_ctx_init (futex_ctx_t *ctx)
 Initialize a per-process futex context.
 
void futex_ctx_deinit (futex_ctx_t *ctx)
 Deinitialize a per-process futex context. *.
 

Detailed Description

Fast User-space Mutex.

Patchwork uses a Futex (Fast User-space Mutex) implementation to let user space implement synchronization primitives like mutexes and conditional variables efficiently.

Function Documentation

◆ futex_ctx_deinit()

void futex_ctx_deinit ( futex_ctx_t ctx)

Deinitialize a per-process futex context. *.

Parameters
ctxPointer to the futex context to deinitialize.

Definition at line 21 of file futex.c.

References map_t::capacity, CONTAINER_OF, map_t::entries, free(), futex(), futex_ctx_t::futexes, map_deinit(), MAP_ENTRY_PTR_IS_VALID, and wait_queue_deinit().

Referenced by process_free().

◆ futex_ctx_init()

void futex_ctx_init ( futex_ctx_t ctx)

Initialize a per-process futex context.

Parameters
ctxPointer to the futex context to initialize.

Definition at line 15 of file futex.c.

References futex_ctx_t::futexes, futex_ctx_t::lock, lock_init(), and map_init().

Referenced by process_init().