P99
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Data Structures | Defines | Typedefs | Enumerations | Functions
p99_atomic.h File Reference
#include "p99_enum.h"
#include "p99_generic.h"
#include "p99_block.h"
+ Include dependency graph for p99_atomic.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  atomic_flag
 The "minimal" type for which atomic operations must be defined. More...

Defines

#define _Atomic(T)   P99_PASTE2(atomic_, T)
 refer to an atomic type of base type T
#define ATOMIC_BOOL_LOCK_FREE   0
#define ATOMIC_CHAR16_T_LOCK_FREE   ATOMIC_INT16_LOCK_FREE
#define ATOMIC_CHAR32_T_LOCK_FREE   ATOMIC_INT32_LOCK_FREE
#define ATOMIC_CHAR_LOCK_FREE   ATOMIC_INT8_LOCK_FREE
#define atomic_compare_exchange_weak(OBJP, EXPECTED, DESIRED)
 Atomically compare *OBJP to *EXPECTED and set it to DESIRED if they are equal.
#define atomic_fetch_add(OBJP, OPERAND)   P00_FETCH_OP((OBJP), (OPERAND), __sync_fetch_and_add, +=)
 Atomically add OPERAND to *OBJP.
#define atomic_fetch_add_conditional(OBJP, OPERAND)
#define atomic_fetch_and(OBJP, OPERAND)   P00_FETCH_OP((OBJP), (OPERAND), __sync_fetch_and_and, &=)
 Atomically do a bitwise and operation between OPERAND and *OBJP.
#define atomic_fetch_and_store(OBJP, DESIRED)
 Store DESIRED into the object behind OBJP and return its previous value.
#define atomic_fetch_max(OBJP, OPERAND)
#define atomic_fetch_or(OBJP, OPERAND)   P00_FETCH_OP((OBJP), (OPERAND), __sync_fetch_and_or, |=)
 Atomically do a bitwise or operation between OPERAND and *OBJP.
#define atomic_fetch_sub(OBJP, OPERAND)   P00_FETCH_OP((OBJP), (OPERAND), __sync_fetch_and_sub, -=)
 Atomically subtract OPERAND from *OBJP.
#define atomic_fetch_xor(OBJP, OPERAND)   P00_FETCH_OP((OBJP), (OPERAND), __sync_fetch_and_xor, ^=)
 Atomically do a bitwise xor operation between OPERAND and *OBJP.
#define atomic_init(OBJP, VAL)
 Initialize the object behind OBJP with value VAL.
#define ATOMIC_INT128_LOCK_FREE   0
#define ATOMIC_INT16_LOCK_FREE   0
#define ATOMIC_INT32_LOCK_FREE   0
#define ATOMIC_INT64_LOCK_FREE   0
#define ATOMIC_INT8_LOCK_FREE   0
#define ATOMIC_INT_LOCK_FREE   ATOMIC_INT8_LOCK_FREE
#define ATOMIC_INTPTR_LOCK_FREE   ATOMIC_INT8_LOCK_FREE
#define atomic_is_lock_free(OBJP)   (!offsetof(__typeof__(*OBJP), p00_xval))
 return true if OBJP points to a lock-free object
#define ATOMIC_LLONG_LOCK_FREE   ATOMIC_INT8_LOCK_FREE
#define atomic_load(OBJP)
 Return the value of the object behind OBJP.
#define ATOMIC_LONG_LOCK_FREE   ATOMIC_INT8_LOCK_FREE
#define ATOMIC_POINTER_LOCK_FREE   ATOMIC_INTPTR_LOCK_FREE
#define ATOMIC_SHORT_LOCK_FREE   ATOMIC_INT8_LOCK_FREE
#define atomic_signal_fence   atomic_thread_fence
#define atomic_store(OBJP, DES)
 Store DESIRED into the object behind OBJP.
#define ATOMIC_VAR_INIT(V)   { .p00_xval = { .p00_t = (V), }, }
 Initialize a variable of an atomic type.
#define ATOMIC_WCHAR_LOCK_FREE   ATOMIC_INT8_LOCK_FREE
#define P99_ATOMIC_INHERIT(T)
#define P99_ATOMIC_LOCK_FREE_TYPES   P00_ATOMIC_LOCK_FREE_TYPES6_
 A list of types that are supposed to have lock-free atomic operations.
#define P99_CRITICAL
 Protect the following block or statement as a critical section of the program.
#define P99_DECLARE_ATOMIC(T, NAME)
 declare an atomic type that will use lock operations to guarantee atomicity
#define P99_DECLARE_ATOMIC_LOCK_FREE(T, NAME)
 declare an atomic type that will have lock-free operations
#define P99_LIFO_CLEAR(L)   atomic_fetch_and_store(L, 0)
 Atomically clear an atomic LIFO L and return a pointer to the start of the list that it previously contained.
#define P99_LIFO_POP(L)
 Pop the top element from an atomic LIFO L.
#define P99_LIFO_PUSH(L, EL)
 Push element EL into an atomic LIFO L.
#define P99_LIFO_TABULATE(TYPE, TAB, L)
#define P99_LIFO_TOP(L)   atomic_load(L)
 Return a pointer to the top element of an atomic LIFO L.
#define P99_SPIN_EXCLUDE(FLAGP)
 Protect the following block or statement as a critical section of the program by using FLAGP as a spinlock.
#define P99_UINT_DEFAULT(T)   __typeof__(P99_GENERIC_SIZE_LIT(sizeof(T), (uintptr_t){ 0 }, P00_UINT_TYPE_LIST))
 A default unsigned integer type for type T.

Typedefs

typedef struct atomic_bool atomic_bool
 Atomic access to a value of type bool
typedef struct atomic_double
_Complex double _Complex 
atomic_cdouble
typedef struct atomic_float
_Complex float _Complex 
atomic_cfloat
typedef struct atomic_char atomic_char
typedef atomic_char16_t atomic_char16_t
typedef atomic_char32_t atomic_char32_t
typedef struct atomic_char_ptr atomic_char_ptr
typedef struct atomic_long
double _Complex long double
_Complex 
atomic_cldouble
typedef struct atomic_double double atomic_double
typedef struct atomic_flag atomic_flag
typedef struct atomic_float float atomic_float
typedef struct atomic_int atomic_int
 Atomic access to a value of type int
typedef atomic_int_fast16_t atomic_int_fast16_t
typedef atomic_int_fast32_t atomic_int_fast32_t
typedef atomic_int_fast64_t atomic_int_fast64_t
typedef atomic_int_fast8_t atomic_int_fast8_t
typedef atomic_int_least16_t atomic_int_least16_t
typedef atomic_int_least32_t atomic_int_least32_t
typedef atomic_int_least64_t atomic_int_least64_t
typedef atomic_int_least8_t atomic_int_least8_t
typedef atomic_intmax_t atomic_intmax_t
typedef atomic_intptr_t atomic_intptr_t
typedef struct atomic_long
double long double 
atomic_ldouble
typedef struct atomic_llong atomic_llong
typedef struct atomic_long atomic_long
typedef atomic_ptrdiff_t atomic_ptrdiff_t
typedef struct atomic_schar atomic_schar
typedef struct atomic_schar_ptr atomic_schar_ptr
typedef struct atomic_short atomic_short
typedef atomic_size_t atomic_size_t
typedef struct atomic_uchar atomic_uchar
typedef struct atomic_uchar_ptr atomic_uchar_ptr
typedef struct atomic_uint atomic_uint
typedef atomic_uint_fast16_t atomic_uint_fast16_t
typedef atomic_uint_fast32_t atomic_uint_fast32_t
typedef atomic_uint_fast64_t atomic_uint_fast64_t
typedef atomic_uint_fast8_t atomic_uint_fast8_t
typedef atomic_uint_least16_t atomic_uint_least16_t
typedef atomic_uint_least32_t atomic_uint_least32_t
typedef atomic_uint_least64_t atomic_uint_least64_t
typedef atomic_uint_least8_t atomic_uint_least8_t
typedef atomic_uintmax_t atomic_uintmax_t
typedef atomic_uintptr_t atomic_uintptr_t
typedef struct atomic_ullong atomic_ullong
typedef struct atomic_ulong atomic_ulong
typedef struct atomic_ushort atomic_ushort
typedef atomic_wchar_t atomic_wchar_t
typedef enum memory_order memory_order
 Enumeration type enum memory_order and typedef memory_order .

Enumerations

enum  memory_order {
  memory_order_relaxed, memory_order_consume, memory_order_acquire, memory_order_release,
  memory_order_acq_rel, memory_order_seq_cst, memory_order_amount, memory_order_max = ((size_t)( memory_order_amount ) - 1u),
  memory_order_min = 0
}

Functions

void atomic_thread_fence (memory_order p00_ord)
char const * memory_order_getname (memory_order p00_x)
 Get a string with the name of constant p00_x of type :: memory_order.
memory_order memory_order_parse (char const *p00_s)
 Parse a string p00_s for the longest matching constant of type :: memory_order.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines