API Reference Manual
1.46.0
|
Atomic variables.
Atomic integers using relaxed memory ordering
Atomic integer types (odp_atomic_u32_t, odp_atomic_u64_t and odp_atomic_u128_t) can be used to implement e.g. shared counters. If not otherwise documented, all functions in this API perform their operations atomically and are implemented using RELAXED memory ordering (see memory order descriptions in the C11 specification). Relaxed operations do not provide synchronization or ordering for other memory accesses (initiated before or after the operation), only atomicity of the operation itself is guaranteed.
Operations with non-relaxed memory ordering
An operation with RELEASE memory ordering (odp_atomic_xxx_rel_xxx()) ensures that other threads loading the same atomic variable with ACQUIRE memory ordering see all stores (from the calling thread) that happened before this releasing store.
An operation with ACQUIRE memory ordering (odp_atomic_xxx_acq_xxx()) ensures that the calling thread sees all stores (done by the releasing thread) that happened before a RELEASE memory ordered store to the same atomic variable.
An operation with ACQUIRE-and-RELEASE memory ordering (odp_atomic_xxx_acq_rel_xxx()) combines the effects of ACQUIRE and RELEASE memory orders. A single operation acts as both an acquiring load and a releasing store.
Data Structures | |
union | odp_atomic_op_t |
Atomic operations. More... | |
Typedefs | |
typedef union odp_atomic_op_t | odp_atomic_op_t |
Atomic operations. More... | |
typedef struct odp_atomic_u128_s | odp_atomic_u128_t |
Atomic 128-bit unsigned integer. More... | |
typedef struct odp_atomic_u64_s | odp_atomic_u64_t |
Atomic 64-bit unsigned integer. More... | |
typedef struct odp_atomic_u32_s | odp_atomic_u32_t |
Atomic 32-bit unsigned integer. More... | |
Functions | |
void | odp_atomic_init_u32 (odp_atomic_u32_t *atom, uint32_t val) |
Initialize atomic uint32 variable. More... | |
uint32_t | odp_atomic_load_u32 (odp_atomic_u32_t *atom) |
Load value of atomic uint32 variable. More... | |
void | odp_atomic_store_u32 (odp_atomic_u32_t *atom, uint32_t val) |
Store value to atomic uint32 variable. More... | |
uint32_t | odp_atomic_fetch_add_u32 (odp_atomic_u32_t *atom, uint32_t val) |
Fetch and add to atomic uint32 variable. More... | |
void | odp_atomic_add_u32 (odp_atomic_u32_t *atom, uint32_t val) |
Add to atomic uint32 variable. More... | |
uint32_t | odp_atomic_fetch_sub_u32 (odp_atomic_u32_t *atom, uint32_t val) |
Fetch and subtract from atomic uint32 variable. More... | |
void | odp_atomic_sub_u32 (odp_atomic_u32_t *atom, uint32_t val) |
Subtract from atomic uint32 variable. More... | |
uint32_t | odp_atomic_fetch_inc_u32 (odp_atomic_u32_t *atom) |
Fetch and increment atomic uint32 variable. More... | |
void | odp_atomic_inc_u32 (odp_atomic_u32_t *atom) |
Increment atomic uint32 variable. More... | |
uint32_t | odp_atomic_fetch_dec_u32 (odp_atomic_u32_t *atom) |
Fetch and decrement atomic uint32 variable. More... | |
void | odp_atomic_dec_u32 (odp_atomic_u32_t *atom) |
Decrement atomic uint32 variable. More... | |
void | odp_atomic_max_u32 (odp_atomic_u32_t *atom, uint32_t new_max) |
Update maximum value of atomic uint32 variable. More... | |
uint32_t | odp_atomic_fetch_max_u32 (odp_atomic_u32_t *atom, uint32_t new_max) |
Fetch and update maximum value of atomic uint32 variable. More... | |
void | odp_atomic_min_u32 (odp_atomic_u32_t *atom, uint32_t new_min) |
Update minimum value of atomic uint32 variable. More... | |
uint32_t | odp_atomic_fetch_min_u32 (odp_atomic_u32_t *atom, uint32_t new_min) |
Fetch and update minimum value of atomic uint32 variable. More... | |
int | odp_atomic_cas_u32 (odp_atomic_u32_t *atom, uint32_t *old_val, uint32_t new_val) |
Compare and swap atomic uint32 variable. More... | |
uint32_t | odp_atomic_xchg_u32 (odp_atomic_u32_t *atom, uint32_t new_val) |
Exchange value of atomic uint32 variable. More... | |
void | odp_atomic_bit_set_u32 (odp_atomic_u32_t *atom, uint32_t bits) |
Set bits in atomic uint32 variable. More... | |
uint32_t | odp_atomic_bit_fetch_set_u32 (odp_atomic_u32_t *atom, uint32_t bits) |
Fetch value and set bits in atomic uint32 variable. More... | |
void | odp_atomic_bit_clr_u32 (odp_atomic_u32_t *atom, uint32_t bits) |
Clear bits in atomic uint32 variable. More... | |
uint32_t | odp_atomic_bit_fetch_clr_u32 (odp_atomic_u32_t *atom, uint32_t bits) |
Fetch value and clear bits in atomic uint32 variable. More... | |
void | odp_atomic_init_u64 (odp_atomic_u64_t *atom, uint64_t val) |
Initialize atomic uint64 variable. More... | |
uint64_t | odp_atomic_load_u64 (odp_atomic_u64_t *atom) |
Load value of atomic uint64 variable. More... | |
void | odp_atomic_store_u64 (odp_atomic_u64_t *atom, uint64_t val) |
Store value to atomic uint64 variable. More... | |
uint64_t | odp_atomic_fetch_add_u64 (odp_atomic_u64_t *atom, uint64_t val) |
Fetch and add to atomic uint64 variable. More... | |
void | odp_atomic_add_u64 (odp_atomic_u64_t *atom, uint64_t val) |
Add to atomic uint64 variable. More... | |
uint64_t | odp_atomic_fetch_sub_u64 (odp_atomic_u64_t *atom, uint64_t val) |
Fetch and subtract from atomic uint64 variable. More... | |
void | odp_atomic_sub_u64 (odp_atomic_u64_t *atom, uint64_t val) |
Subtract from atomic uint64 variable. More... | |
uint64_t | odp_atomic_fetch_inc_u64 (odp_atomic_u64_t *atom) |
Fetch and increment atomic uint64 variable. More... | |
void | odp_atomic_inc_u64 (odp_atomic_u64_t *atom) |
Increment atomic uint64 variable. More... | |
uint64_t | odp_atomic_fetch_dec_u64 (odp_atomic_u64_t *atom) |
Fetch and decrement atomic uint64 variable. More... | |
void | odp_atomic_dec_u64 (odp_atomic_u64_t *atom) |
Decrement atomic uint64 variable. More... | |
void | odp_atomic_max_u64 (odp_atomic_u64_t *atom, uint64_t new_max) |
Update maximum value of atomic uint64 variable. More... | |
uint64_t | odp_atomic_fetch_max_u64 (odp_atomic_u64_t *atom, uint64_t new_max) |
Fetch and update maximum value of atomic uint64 variable. More... | |
void | odp_atomic_min_u64 (odp_atomic_u64_t *atom, uint64_t new_min) |
Update minimum value of atomic uint64 variable. More... | |
uint64_t | odp_atomic_fetch_min_u64 (odp_atomic_u64_t *atom, uint64_t new_min) |
Fetch and update minimum value of atomic uint64_t variable. More... | |
int | odp_atomic_cas_u64 (odp_atomic_u64_t *atom, uint64_t *old_val, uint64_t new_val) |
Compare and swap atomic uint64 variable. More... | |
uint64_t | odp_atomic_xchg_u64 (odp_atomic_u64_t *atom, uint64_t new_val) |
Exchange value of atomic uint64 variable. More... | |
void | odp_atomic_bit_set_u64 (odp_atomic_u64_t *atom, uint64_t bits) |
Set bits in atomic uint64 variable. More... | |
uint64_t | odp_atomic_bit_fetch_set_u64 (odp_atomic_u64_t *atom, uint64_t bits) |
Fetch value and set bits in atomic uint64 variable. More... | |
void | odp_atomic_bit_clr_u64 (odp_atomic_u64_t *atom, uint64_t bits) |
Clear bits in atomic uint64 variable. More... | |
uint64_t | odp_atomic_bit_fetch_clr_u64 (odp_atomic_u64_t *atom, uint64_t bits) |
Fetch value and clear bits in atomic uint64 variable. More... | |
void | odp_atomic_init_u128 (odp_atomic_u128_t *atom, odp_u128_t val) |
Initialize atomic odp_u128_t variable. More... | |
odp_u128_t | odp_atomic_load_u128 (odp_atomic_u128_t *atom) |
Load value of atomic odp_u128_t variable. More... | |
void | odp_atomic_store_u128 (odp_atomic_u128_t *atom, odp_u128_t val) |
Store value to atomic odp_u128_t variable. More... | |
int | odp_atomic_cas_u128 (odp_atomic_u128_t *atom, odp_u128_t *old_val, odp_u128_t new_val) |
Compare and swap atomic odp_u128_t variable. More... | |
uint32_t | odp_atomic_load_acq_u32 (odp_atomic_u32_t *atom) |
Load value of atomic uint32 variable using ACQUIRE memory ordering. More... | |
void | odp_atomic_store_rel_u32 (odp_atomic_u32_t *atom, uint32_t val) |
Store value to atomic uint32 variable using RELEASE memory ordering. More... | |
void | odp_atomic_add_rel_u32 (odp_atomic_u32_t *atom, uint32_t val) |
Add to atomic uint32 variable using RELEASE memory ordering. More... | |
void | odp_atomic_sub_rel_u32 (odp_atomic_u32_t *atom, uint32_t val) |
Subtract from atomic uint32 variable using RELEASE memory ordering. More... | |
int | odp_atomic_cas_acq_u32 (odp_atomic_u32_t *atom, uint32_t *old_val, uint32_t new_val) |
Compare and swap atomic uint32 variable using ACQUIRE memory ordering. More... | |
int | odp_atomic_cas_rel_u32 (odp_atomic_u32_t *atom, uint32_t *old_val, uint32_t new_val) |
Compare and swap atomic uint32 variable using RELEASE memory ordering. More... | |
int | odp_atomic_cas_acq_rel_u32 (odp_atomic_u32_t *atom, uint32_t *old_val, uint32_t new_val) |
Compare and swap atomic uint32 variable using ACQUIRE-and-RELEASE memory ordering. More... | |
void | odp_atomic_bit_set_rel_u32 (odp_atomic_u32_t *atom, uint32_t bits) |
Set bits in atomic uint32 variable using RELEASE memory ordering. More... | |
void | odp_atomic_bit_clr_rel_u32 (odp_atomic_u32_t *atom, uint32_t bits) |
Clear bits in atomic uint32 variable using RELEASE memory ordering. More... | |
uint64_t | odp_atomic_load_acq_u64 (odp_atomic_u64_t *atom) |
Load value of atomic uint64 variable using ACQUIRE memory ordering. More... | |
void | odp_atomic_store_rel_u64 (odp_atomic_u64_t *atom, uint64_t val) |
Store value to atomic uint64 variable using RELEASE memory ordering. More... | |
void | odp_atomic_add_rel_u64 (odp_atomic_u64_t *atom, uint64_t val) |
Add to atomic uint64 variable using RELEASE memory ordering. More... | |
void | odp_atomic_sub_rel_u64 (odp_atomic_u64_t *atom, uint64_t val) |
Subtract from atomic uint64 variable using RELEASE memory ordering. More... | |
int | odp_atomic_cas_acq_u64 (odp_atomic_u64_t *atom, uint64_t *old_val, uint64_t new_val) |
Compare and swap atomic uint64 variable using ACQUIRE memory ordering. More... | |
int | odp_atomic_cas_rel_u64 (odp_atomic_u64_t *atom, uint64_t *old_val, uint64_t new_val) |
Compare and swap atomic uint64 variable using RELEASE memory ordering. More... | |
int | odp_atomic_cas_acq_rel_u64 (odp_atomic_u64_t *atom, uint64_t *old_val, uint64_t new_val) |
Compare and swap atomic uint64 variable using ACQUIRE-and-RELEASE memory ordering. More... | |
void | odp_atomic_bit_set_rel_u64 (odp_atomic_u64_t *atom, uint64_t bits) |
Set bits in atomic uint64 variable using RELEASE memory ordering. More... | |
void | odp_atomic_bit_clr_rel_u64 (odp_atomic_u64_t *atom, uint64_t bits) |
Clear bits in atomic uint64 variable using RELEASE memory ordering. More... | |
int | odp_atomic_lock_free_u64 (odp_atomic_op_t *atomic_op) |
Query which atomic uint64 operations are lock-free. More... | |
int | odp_atomic_cas_acq_u128 (odp_atomic_u128_t *atom, odp_u128_t *old_val, odp_u128_t new_val) |
Compare and swap atomic odp_u128_t variable using ACQUIRE memory ordering. More... | |
int | odp_atomic_cas_rel_u128 (odp_atomic_u128_t *atom, odp_u128_t *old_val, odp_u128_t new_val) |
Compare and swap atomic odp_u128_t variable using RELEASE memory ordering. More... | |
int | odp_atomic_cas_acq_rel_u128 (odp_atomic_u128_t *atom, odp_u128_t *old_val, odp_u128_t new_val) |
Compare and swap atomic odp_u128_t variable using ACQUIRE-and-RELEASE memory ordering. More... | |
int | odp_atomic_lock_free_u128 (odp_atomic_op_t *atomic_op) |
Query which atomic odp_atomic_u128_t operations are lock-free. More... | |
typedef union odp_atomic_op_t odp_atomic_op_t |
Atomic operations.
Atomic operations listed in a bit field structure.
Atomic 128-bit unsigned integer.
Atomic 128-bit unsigned integer
Atomic 64-bit unsigned integer.
Atomic 64-bit unsigned integer
Atomic 32-bit unsigned integer.
Atomic 32-bit unsigned integer
void odp_atomic_init_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | val | ||
) |
Initialize atomic uint32 variable.
Initializes the atomic variable with 'val'. This operation is not atomic. Application must ensure that there's no race condition while initializing the variable.
atom | Pointer to atomic variable |
val | Value to initialize the variable with |
uint32_t odp_atomic_load_u32 | ( | odp_atomic_u32_t * | atom | ) |
Load value of atomic uint32 variable.
atom | Pointer to atomic variable |
void odp_atomic_store_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | val | ||
) |
Store value to atomic uint32 variable.
atom | Pointer to atomic variable |
val | Value to store in the variable |
uint32_t odp_atomic_fetch_add_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | val | ||
) |
Fetch and add to atomic uint32 variable.
atom | Pointer to atomic variable |
val | Value to be added to the variable |
void odp_atomic_add_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | val | ||
) |
Add to atomic uint32 variable.
atom | Pointer to atomic variable |
val | Value to be added to the variable |
uint32_t odp_atomic_fetch_sub_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | val | ||
) |
Fetch and subtract from atomic uint32 variable.
atom | Pointer to atomic variable |
val | Value to be subtracted from the variable |
void odp_atomic_sub_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | val | ||
) |
Subtract from atomic uint32 variable.
atom | Pointer to atomic variable |
val | Value to be subtracted from the variable |
uint32_t odp_atomic_fetch_inc_u32 | ( | odp_atomic_u32_t * | atom | ) |
Fetch and increment atomic uint32 variable.
atom | Pointer to atomic variable |
void odp_atomic_inc_u32 | ( | odp_atomic_u32_t * | atom | ) |
Increment atomic uint32 variable.
atom | Pointer to atomic variable |
uint32_t odp_atomic_fetch_dec_u32 | ( | odp_atomic_u32_t * | atom | ) |
Fetch and decrement atomic uint32 variable.
atom | Pointer to atomic variable |
void odp_atomic_dec_u32 | ( | odp_atomic_u32_t * | atom | ) |
Decrement atomic uint32 variable.
atom | Pointer to atomic variable |
void odp_atomic_max_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | new_max | ||
) |
Update maximum value of atomic uint32 variable.
Compares value of atomic variable to the new maximum value. If the new value is greater than the current value, writes the new value into the variable.
atom | Pointer to atomic variable |
new_max | New maximum value to be written into the atomic variable |
uint32_t odp_atomic_fetch_max_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | new_max | ||
) |
Fetch and update maximum value of atomic uint32 variable.
Compares value of atomic variable to the new maximum value. If the new value is greater than the current value, writes the new value into the variable. Always returns the original value of the atomic variable.
atom | Pointer to atomic variable |
new_max | New maximum value to be written into the atomic variable |
void odp_atomic_min_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | new_min | ||
) |
Update minimum value of atomic uint32 variable.
Compares value of atomic variable to the new minimum value. If the new value is less than the current value, writes the new value into the variable.
atom | Pointer to atomic variable |
new_min | New minimum value to be written into the atomic variable |
uint32_t odp_atomic_fetch_min_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | new_min | ||
) |
Fetch and update minimum value of atomic uint32 variable.
Compares value of atomic variable to the new minimum value. If the new value is less than the current value, writes the new value into the variable. Always returns the original value of the atomic variable.
atom | Pointer to atomic variable |
new_min | New minimum value to be written into the atomic variable |
int odp_atomic_cas_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t * | old_val, | ||
uint32_t | new_val | ||
) |
Compare and swap atomic uint32 variable.
Compares value of atomic variable to the value pointed by 'old_val'. If the values are equal, the operation writes 'new_val' into the atomic variable and returns success. The operation returns failure only when the values are not equal (strong CAS operation). The current value of atomic variable is written into 'old_val' on failure.
atom | Pointer to atomic variable | |
[in,out] | old_val | Pointer to the old value of the atomic variable. Operation updates this value on failure. |
new_val | New value to be written into the atomic variable |
uint32_t odp_atomic_xchg_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | new_val | ||
) |
Exchange value of atomic uint32 variable.
Atomically replaces the value of atomic variable with the new value. Returns the old value.
atom | Pointer to atomic variable |
new_val | New value of the atomic variable |
void odp_atomic_bit_set_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | bits | ||
) |
Set bits in atomic uint32 variable.
atom | Pointer to atomic variable |
bits | Bits to set |
uint32_t odp_atomic_bit_fetch_set_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | bits | ||
) |
Fetch value and set bits in atomic uint32 variable.
atom | Pointer to atomic variable |
bits | Bits to set |
void odp_atomic_bit_clr_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | bits | ||
) |
Clear bits in atomic uint32 variable.
atom | Pointer to atomic variable |
bits | Bits to clear |
uint32_t odp_atomic_bit_fetch_clr_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | bits | ||
) |
Fetch value and clear bits in atomic uint32 variable.
atom | Pointer to atomic variable |
bits | Bits to clear |
void odp_atomic_init_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | val | ||
) |
Initialize atomic uint64 variable.
Initializes the atomic variable with 'val'. This operation is not atomic. Application must ensure that there's no race condition while initializing the variable.
atom | Pointer to atomic variable |
val | Value to initialize the variable with |
uint64_t odp_atomic_load_u64 | ( | odp_atomic_u64_t * | atom | ) |
Load value of atomic uint64 variable.
atom | Pointer to atomic variable |
void odp_atomic_store_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | val | ||
) |
Store value to atomic uint64 variable.
atom | Pointer to atomic variable |
val | Value to store in the variable |
uint64_t odp_atomic_fetch_add_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | val | ||
) |
Fetch and add to atomic uint64 variable.
atom | Pointer to atomic variable |
val | Value to be added to the variable |
void odp_atomic_add_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | val | ||
) |
Add to atomic uint64 variable.
atom | Pointer to atomic variable |
val | Value to be added to the variable |
uint64_t odp_atomic_fetch_sub_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | val | ||
) |
Fetch and subtract from atomic uint64 variable.
atom | Pointer to atomic variable |
val | Value to be subtracted from the variable |
void odp_atomic_sub_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | val | ||
) |
Subtract from atomic uint64 variable.
atom | Pointer to atomic variable |
val | Value to be subtracted from the variable |
uint64_t odp_atomic_fetch_inc_u64 | ( | odp_atomic_u64_t * | atom | ) |
Fetch and increment atomic uint64 variable.
atom | Pointer to atomic variable |
void odp_atomic_inc_u64 | ( | odp_atomic_u64_t * | atom | ) |
Increment atomic uint64 variable.
atom | Pointer to atomic variable |
uint64_t odp_atomic_fetch_dec_u64 | ( | odp_atomic_u64_t * | atom | ) |
Fetch and decrement atomic uint64 variable.
atom | Pointer to atomic variable |
void odp_atomic_dec_u64 | ( | odp_atomic_u64_t * | atom | ) |
Decrement atomic uint64 variable.
atom | Pointer to atomic variable |
void odp_atomic_max_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | new_max | ||
) |
Update maximum value of atomic uint64 variable.
Compares value of atomic variable to the new maximum value. If the new value is greater than the current value, writes the new value into the variable.
atom | Pointer to atomic variable |
new_max | New maximum value to be written into the atomic variable |
uint64_t odp_atomic_fetch_max_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | new_max | ||
) |
Fetch and update maximum value of atomic uint64 variable.
Compares value of atomic variable to the new maximum value. If the new value is greater than the current value, writes the new value into the variable. Always returns the original value of the atomic variable.
atom | Pointer to atomic variable |
new_max | New maximum value to be written into the atomic variable |
void odp_atomic_min_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | new_min | ||
) |
Update minimum value of atomic uint64 variable.
Compares value of atomic variable to the new minimum value. If the new value is less than the current value, writes the new value into the variable.
atom | Pointer to atomic variable |
new_min | New minimum value to be written into the atomic variable |
uint64_t odp_atomic_fetch_min_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | new_min | ||
) |
Fetch and update minimum value of atomic uint64_t variable.
Compares value of atomic variable to the new minimum value. If the new value is less than the current value, writes the new value into the variable. Always returns the original value of the atomic variable.
atom | Pointer to atomic variable |
new_min | New minimum value to be written into the atomic variable |
int odp_atomic_cas_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t * | old_val, | ||
uint64_t | new_val | ||
) |
Compare and swap atomic uint64 variable.
Compares value of atomic variable to the value pointed by 'old_val'. If the values are equal, the operation writes 'new_val' into the atomic variable and returns success. The operation returns failure only when the values are not equal (strong CAS operation). The current value of atomic variable is written into 'old_val' on failure.
atom | Pointer to atomic variable | |
[in,out] | old_val | Pointer to the old value of the atomic variable. Operation updates this value on failure. |
new_val | New value to be written into the atomic variable |
uint64_t odp_atomic_xchg_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | new_val | ||
) |
Exchange value of atomic uint64 variable.
Atomically replaces the value of atomic variable with the new value. Returns the old value.
atom | Pointer to atomic variable |
new_val | New value of the atomic variable |
void odp_atomic_bit_set_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | bits | ||
) |
Set bits in atomic uint64 variable.
atom | Pointer to atomic variable |
bits | Bits to set |
uint64_t odp_atomic_bit_fetch_set_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | bits | ||
) |
Fetch value and set bits in atomic uint64 variable.
atom | Pointer to atomic variable |
bits | Bits to set |
void odp_atomic_bit_clr_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | bits | ||
) |
Clear bits in atomic uint64 variable.
atom | Pointer to atomic variable |
bits | Bits to clear |
uint64_t odp_atomic_bit_fetch_clr_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | bits | ||
) |
Fetch value and clear bits in atomic uint64 variable.
atom | Pointer to atomic variable |
bits | Bits to clear |
void odp_atomic_init_u128 | ( | odp_atomic_u128_t * | atom, |
odp_u128_t | val | ||
) |
Initialize atomic odp_u128_t variable.
Initializes the atomic variable with 'val'. This operation is not atomic. Application must ensure that there's no race condition while initializing the variable.
atom | Pointer to atomic variable |
val | Value to initialize the variable with |
odp_u128_t odp_atomic_load_u128 | ( | odp_atomic_u128_t * | atom | ) |
Load value of atomic odp_u128_t variable.
atom | Pointer to atomic variable |
void odp_atomic_store_u128 | ( | odp_atomic_u128_t * | atom, |
odp_u128_t | val | ||
) |
Store value to atomic odp_u128_t variable.
atom | Pointer to atomic variable |
val | Value to store in the variable |
int odp_atomic_cas_u128 | ( | odp_atomic_u128_t * | atom, |
odp_u128_t * | old_val, | ||
odp_u128_t | new_val | ||
) |
Compare and swap atomic odp_u128_t variable.
Compares value of atomic variable to the value pointed by 'old_val'. If the values are equal, the operation writes 'new_val' into the atomic variable and returns success. The operation returns failure only when the values are not equal (strong CAS operation). The current value of atomic variable is written into 'old_val' on failure.
atom | Pointer to atomic variable | |
[in,out] | old_val | Pointer to the old value of the atomic variable. Operation updates this value on failure. |
new_val | New value to be written into the atomic variable |
uint32_t odp_atomic_load_acq_u32 | ( | odp_atomic_u32_t * | atom | ) |
Load value of atomic uint32 variable using ACQUIRE memory ordering.
Otherwise identical to odp_atomic_load_u32() but ensures ACQUIRE memory ordering.
atom | Pointer to atomic variable |
void odp_atomic_store_rel_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | val | ||
) |
Store value to atomic uint32 variable using RELEASE memory ordering.
Otherwise identical to odp_atomic_store_u32() but ensures RELEASE memory ordering.
atom | Pointer to atomic variable |
val | Value to store in the variable |
void odp_atomic_add_rel_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | val | ||
) |
Add to atomic uint32 variable using RELEASE memory ordering.
Otherwise identical to odp_atomic_add_u32() but ensures RELEASE memory ordering.
atom | Pointer to atomic variable |
val | Value to be added to the variable |
void odp_atomic_sub_rel_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | val | ||
) |
Subtract from atomic uint32 variable using RELEASE memory ordering.
Otherwise identical to odp_atomic_sub_u32() but ensures RELEASE memory ordering.
atom | Pointer to atomic variable |
val | Value to be subtracted from the variable |
int odp_atomic_cas_acq_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t * | old_val, | ||
uint32_t | new_val | ||
) |
Compare and swap atomic uint32 variable using ACQUIRE memory ordering.
Otherwise identical to odp_atomic_cas_u32() but ensures ACQUIRE memory ordering on success. Memory ordering is RELAXED on failure.
atom | Pointer to atomic variable | |
[in,out] | old_val | Pointer to the old value of the atomic variable. Operation updates this value on failure. |
new_val | New value to be written into the atomic variable |
int odp_atomic_cas_rel_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t * | old_val, | ||
uint32_t | new_val | ||
) |
Compare and swap atomic uint32 variable using RELEASE memory ordering.
Otherwise identical to odp_atomic_cas_u32() but ensures RELEASE memory ordering on success. Memory ordering is RELAXED on failure.
atom | Pointer to atomic variable | |
[in,out] | old_val | Pointer to the old value of the atomic variable. Operation updates this value on failure. |
new_val | New value to be written into the atomic variable |
int odp_atomic_cas_acq_rel_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t * | old_val, | ||
uint32_t | new_val | ||
) |
Compare and swap atomic uint32 variable using ACQUIRE-and-RELEASE memory ordering.
Otherwise identical to odp_atomic_cas_u32() but ensures ACQUIRE-and-RELEASE memory ordering on success. Memory ordering is RELAXED on failure.
atom | Pointer to atomic variable | |
[in,out] | old_val | Pointer to the old value of the atomic variable. Operation updates this value on failure. |
new_val | New value to be written into the atomic variable |
void odp_atomic_bit_set_rel_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | bits | ||
) |
Set bits in atomic uint32 variable using RELEASE memory ordering.
Otherwise identical to odp_atomic_bit_set_u32() but ensures RELEASE memory ordering.
atom | Pointer to atomic variable |
bits | Bits to set |
void odp_atomic_bit_clr_rel_u32 | ( | odp_atomic_u32_t * | atom, |
uint32_t | bits | ||
) |
Clear bits in atomic uint32 variable using RELEASE memory ordering.
Otherwise identical to odp_atomic_bit_clr_u32() but ensures RELEASE memory ordering.
atom | Pointer to atomic variable |
bits | Bits to clear |
uint64_t odp_atomic_load_acq_u64 | ( | odp_atomic_u64_t * | atom | ) |
Load value of atomic uint64 variable using ACQUIRE memory ordering.
Otherwise identical to odp_atomic_load_u64() but ensures ACQUIRE memory ordering.
atom | Pointer to atomic variable |
void odp_atomic_store_rel_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | val | ||
) |
Store value to atomic uint64 variable using RELEASE memory ordering.
Otherwise identical to odp_atomic_store_u64() but ensures RELEASE memory ordering.
atom | Pointer to atomic variable |
val | Value to store in the variable |
void odp_atomic_add_rel_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | val | ||
) |
Add to atomic uint64 variable using RELEASE memory ordering.
Otherwise identical to odp_atomic_add_u64() but ensures RELEASE memory ordering.
atom | Pointer to atomic variable |
val | Value to be added to the variable |
void odp_atomic_sub_rel_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | val | ||
) |
Subtract from atomic uint64 variable using RELEASE memory ordering.
Otherwise identical to odp_atomic_sub_u64() but ensures RELEASE memory ordering.
atom | Pointer to atomic variable |
val | Value to be subtracted from the variable |
int odp_atomic_cas_acq_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t * | old_val, | ||
uint64_t | new_val | ||
) |
Compare and swap atomic uint64 variable using ACQUIRE memory ordering.
Otherwise identical to odp_atomic_cas_u64() but ensures ACQUIRE memory ordering on success. Memory ordering is RELAXED on failure.
atom | Pointer to atomic variable | |
[in,out] | old_val | Pointer to the old value of the atomic variable. Operation updates this value on failure. |
new_val | New value to be written into the atomic variable |
int odp_atomic_cas_rel_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t * | old_val, | ||
uint64_t | new_val | ||
) |
Compare and swap atomic uint64 variable using RELEASE memory ordering.
Otherwise identical to odp_atomic_cas_u64() but ensures RELEASE memory ordering on success. Memory ordering is RELAXED on failure.
atom | Pointer to atomic variable | |
[in,out] | old_val | Pointer to the old value of the atomic variable. Operation updates this value on failure. |
new_val | New value to be written into the atomic variable |
int odp_atomic_cas_acq_rel_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t * | old_val, | ||
uint64_t | new_val | ||
) |
Compare and swap atomic uint64 variable using ACQUIRE-and-RELEASE memory ordering.
Otherwise identical to odp_atomic_cas_u64() but ensures ACQUIRE-and-RELEASE memory ordering on success. Memory ordering is RELAXED on failure.
atom | Pointer to atomic variable | |
[in,out] | old_val | Pointer to the old value of the atomic variable. Operation updates this value on failure. |
new_val | New value to be written into the atomic variable |
void odp_atomic_bit_set_rel_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | bits | ||
) |
Set bits in atomic uint64 variable using RELEASE memory ordering.
Otherwise identical to odp_atomic_bit_set_u64() but ensures RELEASE memory ordering.
atom | Pointer to atomic variable |
bits | Bits to set |
void odp_atomic_bit_clr_rel_u64 | ( | odp_atomic_u64_t * | atom, |
uint64_t | bits | ||
) |
Clear bits in atomic uint64 variable using RELEASE memory ordering.
Otherwise identical to odp_atomic_bit_clr_u64() but ensures RELEASE memory ordering.
atom | Pointer to atomic variable |
bits | Bits to clear |
int odp_atomic_lock_free_u64 | ( | odp_atomic_op_t * | atomic_op | ) |
Query which atomic uint64 operations are lock-free.
Lock-free implementations have higher performance and scale better than implementations using locks. User can decide to use e.g. uint32 atomic variables instead of uint64 to optimize performance on platforms that implement a performance critical operation using locks.
Init operations (e.g. odp_atomic_init_u64()) are not atomic. This function clears the op.init bit but will never set it to one.
atomic_op | Pointer to atomic operation structure for storing operation flags. All bits are initialized to zero during the operation. The parameter is ignored when NULL. |
0 | None of the operations are lock-free |
1 | Some of the operations are lock-free |
2 | All operations are lock-free |
int odp_atomic_cas_acq_u128 | ( | odp_atomic_u128_t * | atom, |
odp_u128_t * | old_val, | ||
odp_u128_t | new_val | ||
) |
Compare and swap atomic odp_u128_t variable using ACQUIRE memory ordering.
Otherwise identical to odp_atomic_cas_u128() but ensures ACQUIRE memory ordering on success. Memory ordering is RELAXED on failure.
atom | Pointer to atomic variable | |
[in,out] | old_val | Pointer to the old value of the atomic variable. Operation updates this value on failure. |
new_val | New value to be written into the atomic variable |
int odp_atomic_cas_rel_u128 | ( | odp_atomic_u128_t * | atom, |
odp_u128_t * | old_val, | ||
odp_u128_t | new_val | ||
) |
Compare and swap atomic odp_u128_t variable using RELEASE memory ordering.
Otherwise identical to odp_atomic_cas_u128() but ensures RELEASE memory ordering on success. Memory ordering is RELAXED on failure.
atom | Pointer to atomic variable | |
[in,out] | old_val | Pointer to the old value of the atomic variable. Operation updates this value on failure. |
new_val | New value to be written into the atomic variable |
int odp_atomic_cas_acq_rel_u128 | ( | odp_atomic_u128_t * | atom, |
odp_u128_t * | old_val, | ||
odp_u128_t | new_val | ||
) |
Compare and swap atomic odp_u128_t variable using ACQUIRE-and-RELEASE memory ordering.
Otherwise identical to odp_atomic_cas_u128() but ensures ACQUIRE-and-RELEASE memory ordering on success. Memory ordering is RELAXED on failure.
atom | Pointer to atomic variable | |
[in,out] | old_val | Pointer to the old value of the atomic variable. Operation updates this value on failure. |
new_val | New value to be written into the atomic variable |
int odp_atomic_lock_free_u128 | ( | odp_atomic_op_t * | atomic_op | ) |
Query which atomic odp_atomic_u128_t operations are lock-free.
Lock-free implementations have higher performance and scale better than implementations using locks.
Init operations (e.g. odp_atomic_init_u128()) are not atomic. This function clears the op.init bit but will never set it to one.
Note: 128-bit atomic API includes only init, load, store and CAS operations.
atomic_op | Pointer to atomic operation structure for storing operation flags. All bits are initialized to zero during the operation. The parameter is ignored when NULL. |
0 | None of the 128-bit atomic operations are lock-free |
1 | Some of the 128-bit atomic operations are lock-free |
2 | All 128-bit atomic operations are lock-free |