Atomics
Atomic helpers
-
atomic_load_acquire
atomic_load_acquire (ptr)
Syntactic suger for __atomic_load_n
Parameters
ptr
Pointer to value
Description
Atomically load the value of ptr with acquire semantics.
Return
The contents of *ptr
.
-
atomic_store_release
atomic_store_release (ptr, val)
Syntactic suger for __atomic_store_n
Parameters
ptr
Pointer to value
val
Value
Description
Atomically store val in ptr with release semantics.
-
atomic_inc_fetch
atomic_inc_fetch (ptr)
Syntactic suger for __atomic_add_fetch
Parameters
ptr
Pointer to value
Description
Atomically increment the value at ptr and then fetch it with sequential consistency semantics.
Return
The incremented value
-
atomic_dec_fetch
atomic_dec_fetch (ptr)
Syntactic suger for __atomic_sub_fetch
Parameters
ptr
Pointer to value
Description
Atomically decrement the value at ptr and then fetch it with sequential consistency semantics.
Return
The decremented value
-
atomic_inc
atomic_inc (ptr)
Syntactic suger for __atomic_fetch_add
Parameters
ptr
Pointer to value
Description
Atomically increment the value at ptr with sequential consistency semantics.
Return
The previously stored value
-
atomic_dec
atomic_dec (ptr)
Syntactic suger for __atomic_fetch_sub
Parameters
ptr
Pointer to value
Description
Atomically decrement the value at ptr with sequential consistency semantics.
Return
The previously stored value
-
atomic_cmpxchg
atomic_cmpxchg (ptr, expected, desired)
Syntactic suger for __atomic_compare_exchange_n
Parameters
ptr
Pointer to value to compare
expected
Expected value
desired
Value that should be set
Description
Perform an atomic compare-and-exchange on ptr.
Return
Boolean, indicating if the CAS succeeded.