Go to the documentation of this file.
31 #define P00_FUTEX_INLINE(NAME) p99_inline
33 #elif (defined(__linux__) && !defined(NO_FUTEX)) || defined(DOXYGEN)
35 #define P00_FUTEX_INLINE(NAME) p99_inline
41 #define P00_FUTEX_INLINE(NAME) P99_WEAK(NAME)
178 # define P99_FUTEX_MAX_WAITERS (INT_MAX+0U)
221 unsigned p00_cstart,
unsigned p00_clen,
222 unsigned p00_wmin,
unsigned p00_wmax);
225 #define p99_futex_add(...) P99_CALL_DEFARG(p99_futex_add, 6, __VA_ARGS__)
226 #define p99_futex_add_defarg_3() 1u
227 #define p99_futex_add_defarg_4() 0u
228 #define p99_futex_add_defarg_5() P99_FUTEX_MAX_WAITERS
262 unsigned p00_cstart,
unsigned p00_clen,
263 unsigned p00_wmin,
unsigned p00_wmax);
266 #define p99_futex_exchange(...) P99_CALL_DEFARG(p99_futex_exchange, 6, __VA_ARGS__)
267 #define p99_futex_exchange_defarg_3() 1u
268 #define p99_futex_exchange_defarg_4() 0u
269 #define p99_futex_exchange_defarg_5() P99_FUTEX_MAX_WAITERS
284 unsigned p00_wmin,
unsigned p00_wmax);
563 #define P99_FUTEX_COMPARE_EXCHANGE(FUTEX, ACT, EXPECTED, DESIRED, WAKEMIN, WAKEMAX)
570 #if (defined(__linux__) && !defined(NO_FUTEX)) || defined(DOXYGEN)
void p99_futex_destroy(p99_futex *p00_c)
Destroy an p99_futex object.
A counter similar to a conditional variable that allows atomic increment and decrement and to wait fo...
unsigned p99_futex_exchange(p99_futex volatile *p00_fut, unsigned p00_desired, unsigned p00_cstart, unsigned p00_clen, unsigned p00_wmin, unsigned p00_wmax)
Unconditionally and atomically set the futex p00_fut to value p00_desired.
#define p99_inline
Try to force a function always to be inlined.
#define P99_FUTEX_COMPARE_EXCHANGE(FUTEX, ACT, EXPECTED, DESIRED, WAKEMIN, WAKEMAX)
a catch all macro to operate on p99_futex
#define P99_DEFARG_DOCU(NAME)
Provide a documentation section to a function defined with P99_CALL_DEFARG.
The structure that is used in the fallback implementation of p99_futex on non-linux systems.
#define P99_DECLARE_STRUCT(NAME)
forward declaration of a struct NAME
unsigned p99_futex_load(p99_futex volatile *p00_fut)
Obtain the value of futex p00_fut atomically.
void p99_futex_wakeup(p99_futex volatile *p00_fut, unsigned p00_wmin, unsigned p00_wmax)
Wake up threads that are waiting for a futex.
void p99_futex_wait(p99_futex volatile *p00_fut)
Unconditionally wait for futex p00_fut.
unsigned p99_futex_add(p99_futex volatile *p00_fut, unsigned p00_hmuch, unsigned p00_cstart, unsigned p00_clen, unsigned p00_wmin, unsigned p00_wmax)
increment the counter of p00_fut atomically by p00_hmuch.
p99_futex * p99_futex_init(p99_futex *p00_c, unsigned p00_ini)
Initialize an p99_futex object.