This modules adds some utility functions to perform atomic accesses.
Usage
The atomic utilitys allow atomic access to regular variables.
uint32_t global_counter;
void irq_handler(void)
{
global_counter++;
}
void called_by_thread_a(void) {
on_threshold_reached();
}
}
void called_by_thread_b(void) {
atomic_add_u32(&global_counter, 42);
}
Motivation
There are some reasons why these functions might be chosen over the C11 Atomic Operations Library in some advanced use cases:
- The functions allow mixing of atomic and non-atomic accesses. E.g. while IRQs are disabled anyway, even plain accesses cannot be interrupted but are often more efficient.
- On platforms not supporting lock-free access, a library call is generated instead. The fallback implementation used here is more efficient in terms of both CPU instructions and ROM size.
- On platforms where some operations can be implemented lock free while others can't, at least LLVM will use the library call even for those accesses that can be implemented lock-free. This is because without assuming how the library call implements atomic access for the other functions, mixing library calls and lock free accesses could result in data corruption. But this implementation resorts to disabling IRQs when lock-free implementations are not possible, which mixes well with lock-free accesses. Thus, additional overhead for atomic accesses is only spent where needed.
- In some cases the fallback implementation performs better than the lock free implementation. E.g. if a specific platform has an atomic compare and swap instruction, this could be used to perform a read-modify-write in a loop until the value initially read was not changed in between. Just disabling IRQs to implement an atomic read-modify-write operation is likely more efficient. C11 atomics will however always use the lock free implementation (if such exists), assuming that this is more efficient. This assumption was made with desktop class hardware in mind, but is not generally true for bare metal targets. These function allow to optimize for the actual hardware RIOT is running on.
- This library provides "semi-atomic" read-modify-write operations, which are useful when at most one thread is ever writing to memory. In that case, only the write part of the read-modify-write operation needs to be performed in an atomic fashion in order for the reading threads to perceive atomic updates of the variable. This is significantly cheaper than atomic read-modify-write operations for many platforms
Guarantees
- Every utility function here acts as a barrier for code reordering regarding
- For the
atomic_*()
family of functions: The whole operation will be done in an non-interruptible fashion
- For the
semi_atomic_*()
family of functions: The write part of the operation is done atomically. If at most one thread is ever performing changes to a variable using the semi_atomic_()
functions, those changes will appear as if they were atomic to all other threads.
Porting to new CPUs
At the bare minimum, create an empty atomic_utils_arch.h
file. This will result in the fallback implementations being used.
To expose lock-free atomic operations, add an implementation to the atomic_utils_arch.h
file and disable the fallback implementation by defining HAS_<FN_NAME_ALL_CAPS>
, where <FN_NAME_ALL_CAPS>
is the name of the function provided in all upper case. E.g. most platforms will be able to provide lock-free reads and writes up to their word size and can expose this as follows for GCC:
#define HAS_ATOMIC_LOAD_U8
{
return __atomic_load_1(var, __ATOMIC_SEQ_CST);
}
#define HAS_ATOMIC_STORE_U8
{
__atomic_store_1(dest, val, __ATOMIC_SEQ_CST);
}
Note: The semi_atomic_*()
family of functions is always provided using atomic_*()
functions in the cheapest way possible.
|
#define | CONCAT(a, b) a ## b |
| Concatenate two tokens.
|
|
#define | CONCAT4(a, b, c, d) a ## b ## c ## d |
| Concatenate four tokens.
|
|
#define | ATOMIC_LOAD_IMPL(name, type) |
| Generates a static inline function implementing atomic_load_u<width>() More...
|
|
#define | ATOMIC_STORE_IMPL(name, type) |
| Generates a static inline function implementing atomic_store_u<width>() More...
|
|
#define | ATOMIC_FETCH_OP_IMPL(opname, op, name, type) |
| Generates a static inline function implementing atomic_fecth_<op>_u<width>() More...
|
|
◆ ATOMIC_FETCH_OP_IMPL
#define ATOMIC_FETCH_OP_IMPL |
( |
|
opname, |
|
|
|
op, |
|
|
|
name, |
|
|
|
type |
|
) |
| |
Value: static inline void CONCAT4(atomic_fetch_, opname, _,
name)(type *dest, \
type val) \
{ \
\
volatile type *tmp = dest; \
*tmp = *tmp op val; \
irq_restore(state); \
}
Generates a static inline function implementing atomic_fecth_<op>_u<width>()
- Parameters
-
opname | Name of the operator in op , e.g. "and" for + |
op | Operator to implement atomically, e.g. + |
name | Name of the variable type, e.g. "u8" |
type | Variable type, e.g. uint8_t |
Definition at line 775 of file atomic_utils.h.
◆ ATOMIC_LOAD_IMPL
#define ATOMIC_LOAD_IMPL |
( |
|
name, |
|
|
|
type |
|
) |
| |
Value: static inline type
CONCAT(atomic_load_,
name)(
const type *var) \
{ \
\
type result = *((const volatile type *)var); \
irq_restore(state); \
return result; \
}
Generates a static inline function implementing atomic_load_u<width>()
- Parameters
-
name | Name of the variable type, e.g. "u8" |
type | Variable type, e.g. uint8_t |
Definition at line 714 of file atomic_utils.h.
◆ ATOMIC_STORE_IMPL
#define ATOMIC_STORE_IMPL |
( |
|
name, |
|
|
|
type |
|
) |
| |
Value: static inline void CONCAT(atomic_store_,
name)(type *dest, type val) \
{ \
\
*((volatile type *)dest) = val; \
irq_restore(state); \
}
Generates a static inline function implementing atomic_store_u<width>()
- Parameters
-
name | Name of the variable type, e.g. "u8" |
type | Variable type, e.g. uint8_t |
Definition at line 744 of file atomic_utils.h.
◆ atomic_bit_u16()
Create a reference to a bit in an uint16_t
- Parameters
-
[in] | dest | Memory containing the bit |
[in] | bit | Bit number (0 refers to the least significant) |
Definition at line 857 of file atomic_utils.h.
◆ atomic_bit_u32()
Create a reference to a bit in an uint32_t
- Parameters
-
[in] | dest | Memory containing the bit |
[in] | bit | Bit number (0 refers to the least significant) |
Definition at line 862 of file atomic_utils.h.
◆ atomic_bit_u64()
Create a reference to a bit in an uint64_t
- Parameters
-
[in] | dest | Memory containing the bit |
[in] | bit | Bit number (0 refers to the least significant) |
Definition at line 867 of file atomic_utils.h.
◆ atomic_bit_u8()
Create a reference to a bit in an uint8_t
- Parameters
-
[in] | dest | Memory containing the bit |
[in] | bit | Bit number (0 refers to the least significant) |
Definition at line 852 of file atomic_utils.h.
◆ atomic_clear_bit_u16()
Atomic version of *dest &= ~(1 << bit)
- Parameters
-
Definition at line 892 of file atomic_utils.h.
◆ atomic_clear_bit_u32()
Atomic version of *dest &= ~(1 << bit)
- Parameters
-
Definition at line 896 of file atomic_utils.h.
◆ atomic_clear_bit_u64()
Atomic version of *dest &= ~(1 << bit)
- Parameters
-
Definition at line 900 of file atomic_utils.h.
◆ atomic_clear_bit_u8()
Atomic version of *dest &= ~(1 << bit)
- Parameters
-
Definition at line 888 of file atomic_utils.h.
◆ atomic_fetch_add_u16()
static void atomic_fetch_add_u16 |
( |
uint16_t * |
dest, |
|
|
uint16_t |
summand |
|
) |
| |
|
inlinestatic |
Atomically add a value onto a given value.
- Parameters
-
[in,out] | dest | Add summand onto this value atomically in-place |
[in] | summand | Value to add onto dest |
◆ atomic_fetch_add_u32()
static void atomic_fetch_add_u32 |
( |
uint32_t * |
dest, |
|
|
uint32_t |
summand |
|
) |
| |
|
inlinestatic |
Atomically add a value onto a given value.
- Parameters
-
[in,out] | dest | Add summand onto this value atomically in-place |
[in] | summand | Value to add onto dest |
◆ atomic_fetch_add_u64()
static void atomic_fetch_add_u64 |
( |
uint64_t * |
dest, |
|
|
uint64_t |
summand |
|
) |
| |
|
inlinestatic |
Atomically add a value onto a given value.
- Parameters
-
[in,out] | dest | Add summand onto this value atomically in-place |
[in] | summand | Value to add onto dest |
◆ atomic_fetch_add_u8()
static void atomic_fetch_add_u8 |
( |
uint8_t * |
dest, |
|
|
uint8_t |
summand |
|
) |
| |
|
inlinestatic |
Atomically add a value onto a given value.
- Parameters
-
[in,out] | dest | Add summand onto this value atomically in-place |
[in] | summand | Value to add onto dest |
◆ atomic_fetch_and_u16()
static void atomic_fetch_and_u16 |
( |
uint16_t * |
dest, |
|
|
uint16_t |
val |
|
) |
| |
|
inlinestatic |
Atomic version of *dest &= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest & val |
[in] | val | Value to bitwise and into dest in-place |
◆ atomic_fetch_and_u32()
static void atomic_fetch_and_u32 |
( |
uint32_t * |
dest, |
|
|
uint32_t |
val |
|
) |
| |
|
inlinestatic |
Atomic version of *dest &= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest & val |
[in] | val | Value to bitwise and into dest in-place |
◆ atomic_fetch_and_u64()
static void atomic_fetch_and_u64 |
( |
uint64_t * |
dest, |
|
|
uint64_t |
val |
|
) |
| |
|
inlinestatic |
Atomic version of *dest &= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest & val |
[in] | val | Value to bitwise and into dest in-place |
◆ atomic_fetch_and_u8()
static void atomic_fetch_and_u8 |
( |
uint8_t * |
dest, |
|
|
uint8_t |
val |
|
) |
| |
|
inlinestatic |
Atomic version of *dest &= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest & val |
[in] | val | Value to bitwise and into dest in-place |
◆ atomic_fetch_or_u16()
static void atomic_fetch_or_u16 |
( |
uint16_t * |
dest, |
|
|
uint16_t |
val |
|
) |
| |
|
inlinestatic |
Atomic version of *dest |= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest | val |
[in] | val | Value to bitwise or into dest in-place |
◆ atomic_fetch_or_u32()
static void atomic_fetch_or_u32 |
( |
uint32_t * |
dest, |
|
|
uint32_t |
val |
|
) |
| |
|
inlinestatic |
Atomic version of *dest |= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest | val |
[in] | val | Value to bitwise or into dest in-place |
◆ atomic_fetch_or_u64()
static void atomic_fetch_or_u64 |
( |
uint64_t * |
dest, |
|
|
uint64_t |
val |
|
) |
| |
|
inlinestatic |
Atomic version of *dest |= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest | val |
[in] | val | Value to bitwise or into dest in-place |
◆ atomic_fetch_or_u8()
static void atomic_fetch_or_u8 |
( |
uint8_t * |
dest, |
|
|
uint8_t |
val |
|
) |
| |
|
inlinestatic |
Atomic version of *dest |= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest | val |
[in] | val | Value to bitwise or into dest in-place |
◆ atomic_fetch_sub_u16()
static void atomic_fetch_sub_u16 |
( |
uint16_t * |
dest, |
|
|
uint16_t |
subtrahend |
|
) |
| |
|
inlinestatic |
Atomically subtract a value from a given value.
- Parameters
-
[in,out] | dest | Subtract subtrahend from this value atomically in-place |
[in] | subtrahend | Value to subtract from dest |
◆ atomic_fetch_sub_u32()
static void atomic_fetch_sub_u32 |
( |
uint32_t * |
dest, |
|
|
uint32_t |
subtrahend |
|
) |
| |
|
inlinestatic |
Atomically subtract a value from a given value.
- Parameters
-
[in,out] | dest | Subtract subtrahend from this value atomically in-place |
[in] | subtrahend | Value to subtract from dest |
◆ atomic_fetch_sub_u64()
static void atomic_fetch_sub_u64 |
( |
uint64_t * |
dest, |
|
|
uint64_t |
subtrahend |
|
) |
| |
|
inlinestatic |
Atomically subtract a value from a given value.
- Parameters
-
[in,out] | dest | Subtract subtrahend from this value atomically in-place |
[in] | subtrahend | Value to subtract from dest |
◆ atomic_fetch_sub_u8()
static void atomic_fetch_sub_u8 |
( |
uint8_t * |
dest, |
|
|
uint8_t |
subtrahend |
|
) |
| |
|
inlinestatic |
Atomically subtract a value from a given value.
- Parameters
-
[in,out] | dest | Subtract subtrahend from this value atomically in-place |
[in] | subtrahend | Value to subtract from dest |
◆ atomic_fetch_xor_u16()
static void atomic_fetch_xor_u16 |
( |
uint16_t * |
dest, |
|
|
uint16_t |
val |
|
) |
| |
|
inlinestatic |
Atomic version of *dest ^= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest ^ val |
[in] | val | Value to bitwise xor into dest in-place |
◆ atomic_fetch_xor_u32()
static void atomic_fetch_xor_u32 |
( |
uint32_t * |
dest, |
|
|
uint32_t |
val |
|
) |
| |
|
inlinestatic |
Atomic version of *dest ^= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest ^ val |
[in] | val | Value to bitwise xor into dest in-place |
◆ atomic_fetch_xor_u64()
static void atomic_fetch_xor_u64 |
( |
uint64_t * |
dest, |
|
|
uint64_t |
val |
|
) |
| |
|
inlinestatic |
Atomic version of *dest ^= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest ^ val |
[in] | val | Value to bitwise xor into dest in-place |
◆ atomic_fetch_xor_u8()
static void atomic_fetch_xor_u8 |
( |
uint8_t * |
dest, |
|
|
uint8_t |
val |
|
) |
| |
|
inlinestatic |
Atomic version of *dest ^= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest ^ val |
[in] | val | Value to bitwise xor into dest in-place |
◆ atomic_load_u16()
static uint16_t atomic_load_u16 |
( |
const uint16_t * |
var | ) |
|
|
inlinestatic |
Load an uint16_t
atomically.
- Parameters
-
[in] | var | Variable to load atomically |
- Returns
- The value stored in
var
◆ atomic_load_u32()
static uint32_t atomic_load_u32 |
( |
const uint32_t * |
var | ) |
|
|
inlinestatic |
Load an uint32_t
atomically.
- Parameters
-
[in] | var | Variable to load atomically |
- Returns
- The value stored in
var
◆ atomic_load_u64()
static uint64_t atomic_load_u64 |
( |
const uint64_t * |
var | ) |
|
|
inlinestatic |
Load an uint64_t
atomically.
- Parameters
-
[in] | var | Variable to load atomically |
- Returns
- The value stored in
var
◆ atomic_load_u8()
static uint8_t atomic_load_u8 |
( |
const uint8_t * |
var | ) |
|
|
inlinestatic |
Load an uint8_t
atomically.
- Parameters
-
[in] | var | Variable to load atomically |
- Returns
- The value stored in
var
◆ atomic_set_bit_u16()
Atomic version of *dest |= (1 << bit)
- Parameters
-
Definition at line 876 of file atomic_utils.h.
◆ atomic_set_bit_u32()
Atomic version of *dest |= (1 << bit)
- Parameters
-
Definition at line 880 of file atomic_utils.h.
◆ atomic_set_bit_u64()
Atomic version of *dest |= (1 << bit)
- Parameters
-
Definition at line 884 of file atomic_utils.h.
◆ atomic_set_bit_u8()
Atomic version of *dest |= (1 << bit)
- Parameters
-
Definition at line 872 of file atomic_utils.h.
◆ atomic_store_u16()
static void atomic_store_u16 |
( |
uint16_t * |
dest, |
|
|
uint16_t |
val |
|
) |
| |
|
inlinestatic |
Store an uint16_t
atomically.
- Parameters
-
[out] | dest | Location to atomically write the new value to |
[in] | val | Value to write |
◆ atomic_store_u32()
static void atomic_store_u32 |
( |
uint32_t * |
dest, |
|
|
uint32_t |
val |
|
) |
| |
|
inlinestatic |
Store an uint32_t
atomically.
- Parameters
-
[out] | dest | Location to atomically write the new value to |
[in] | val | Value to write |
◆ atomic_store_u64()
static void atomic_store_u64 |
( |
uint64_t * |
dest, |
|
|
uint64_t |
val |
|
) |
| |
|
inlinestatic |
Store an uint64_t
atomically.
- Parameters
-
[out] | dest | Location to atomically write the new value to |
[in] | val | Value to write |
◆ atomic_store_u8()
static void atomic_store_u8 |
( |
uint8_t * |
dest, |
|
|
uint8_t |
val |
|
) |
| |
|
inlinestatic |
Store an uint8_t
atomically.
- Parameters
-
[out] | dest | Location to atomically write the new value to |
[in] | val | Value to write |
◆ semi_atomic_fetch_add_u16()
static void semi_atomic_fetch_add_u16 |
( |
uint16_t * |
dest, |
|
|
uint16_t |
summand |
|
) |
| |
|
inlinestatic |
Semi-atomically add a value onto a given value.
- Parameters
-
[in,out] | dest | Add summand onto this value semi-atomically in-place |
[in] | summand | Value to add onto dest |
Definition at line 930 of file atomic_utils.h.
◆ semi_atomic_fetch_add_u32()
static void semi_atomic_fetch_add_u32 |
( |
uint32_t * |
dest, |
|
|
uint32_t |
summand |
|
) |
| |
|
inlinestatic |
Semi-atomically add a value onto a given value.
- Parameters
-
[in,out] | dest | Add summand onto this value semi-atomically in-place |
[in] | summand | Value to add onto dest |
Definition at line 940 of file atomic_utils.h.
◆ semi_atomic_fetch_add_u64()
static void semi_atomic_fetch_add_u64 |
( |
uint64_t * |
dest, |
|
|
uint64_t |
summand |
|
) |
| |
|
inlinestatic |
Semi-atomically add a value onto a given value.
- Parameters
-
[in,out] | dest | Add summand onto this value semi-atomically in-place |
[in] | summand | Value to add onto dest |
Definition at line 950 of file atomic_utils.h.
◆ semi_atomic_fetch_add_u8()
static void semi_atomic_fetch_add_u8 |
( |
uint8_t * |
dest, |
|
|
uint8_t |
summand |
|
) |
| |
|
inlinestatic |
Semi-atomically add a value onto a given value.
- Parameters
-
[in,out] | dest | Add summand onto this value semi-atomically in-place |
[in] | summand | Value to add onto dest |
Definition at line 920 of file atomic_utils.h.
◆ semi_atomic_fetch_and_u16()
static void semi_atomic_fetch_and_u16 |
( |
uint16_t * |
dest, |
|
|
uint16_t |
val |
|
) |
| |
|
inlinestatic |
Semi-atomic version of *dest &= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest & val |
[in] | val | Value to bitwise and into dest in-place |
Definition at line 1094 of file atomic_utils.h.
◆ semi_atomic_fetch_and_u32()
static void semi_atomic_fetch_and_u32 |
( |
uint32_t * |
dest, |
|
|
uint32_t |
val |
|
) |
| |
|
inlinestatic |
Semi-atomic version of *dest &= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest & val |
[in] | val | Value to bitwise and into dest in-place |
Definition at line 1104 of file atomic_utils.h.
◆ semi_atomic_fetch_and_u64()
static void semi_atomic_fetch_and_u64 |
( |
uint64_t * |
dest, |
|
|
uint64_t |
val |
|
) |
| |
|
inlinestatic |
Semi-atomic version of *dest &= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest & val |
[in] | val | Value to bitwise and into dest in-place |
Definition at line 1114 of file atomic_utils.h.
◆ semi_atomic_fetch_and_u8()
static void semi_atomic_fetch_and_u8 |
( |
uint8_t * |
dest, |
|
|
uint8_t |
val |
|
) |
| |
|
inlinestatic |
Semi-atomic version of *dest &= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest & val |
[in] | val | Value to bitwise and into dest in-place |
Definition at line 1084 of file atomic_utils.h.
◆ semi_atomic_fetch_or_u16()
static void semi_atomic_fetch_or_u16 |
( |
uint16_t * |
dest, |
|
|
uint16_t |
val |
|
) |
| |
|
inlinestatic |
Semi-atomic version of *dest |= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest | val |
[in] | val | Value to bitwise or into dest in-place |
Definition at line 1012 of file atomic_utils.h.
◆ semi_atomic_fetch_or_u32()
static void semi_atomic_fetch_or_u32 |
( |
uint32_t * |
dest, |
|
|
uint32_t |
val |
|
) |
| |
|
inlinestatic |
Semi-atomic version of *dest |= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest | val |
[in] | val | Value to bitwise or into dest in-place |
Definition at line 1022 of file atomic_utils.h.
◆ semi_atomic_fetch_or_u64()
static void semi_atomic_fetch_or_u64 |
( |
uint64_t * |
dest, |
|
|
uint64_t |
val |
|
) |
| |
|
inlinestatic |
Semi-atomic version of *dest |= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest | val |
[in] | val | Value to bitwise or into dest in-place |
Definition at line 1032 of file atomic_utils.h.
◆ semi_atomic_fetch_or_u8()
static void semi_atomic_fetch_or_u8 |
( |
uint8_t * |
dest, |
|
|
uint8_t |
val |
|
) |
| |
|
inlinestatic |
Semi-atomic version of *dest |= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest | val |
[in] | val | Value to bitwise or into dest in-place |
Definition at line 1002 of file atomic_utils.h.
◆ semi_atomic_fetch_sub_u16()
static void semi_atomic_fetch_sub_u16 |
( |
uint16_t * |
dest, |
|
|
uint16_t |
subtrahend |
|
) |
| |
|
inlinestatic |
Semi-atomically subtract a value from a given value.
- Parameters
-
[in,out] | dest | Subtract subtrahend from this value semi-atomically in-place |
[in] | subtrahend | Value to subtract from dest |
Definition at line 971 of file atomic_utils.h.
◆ semi_atomic_fetch_sub_u32()
static void semi_atomic_fetch_sub_u32 |
( |
uint32_t * |
dest, |
|
|
uint32_t |
subtrahend |
|
) |
| |
|
inlinestatic |
Semi-atomically subtract a value from a given value.
- Parameters
-
[in,out] | dest | Subtract subtrahend from this value semi-atomically in-place |
[in] | subtrahend | Value to subtract from dest |
Definition at line 981 of file atomic_utils.h.
◆ semi_atomic_fetch_sub_u64()
static void semi_atomic_fetch_sub_u64 |
( |
uint64_t * |
dest, |
|
|
uint64_t |
subtrahend |
|
) |
| |
|
inlinestatic |
Semi-atomically subtract a value from a given value.
- Parameters
-
[in,out] | dest | Subtract subtrahend from this value semi-atomically in-place |
[in] | subtrahend | Value to subtract from dest |
Definition at line 991 of file atomic_utils.h.
◆ semi_atomic_fetch_sub_u8()
static void semi_atomic_fetch_sub_u8 |
( |
uint8_t * |
dest, |
|
|
uint8_t |
subtrahend |
|
) |
| |
|
inlinestatic |
Semi-atomically subtract a value from a given value.
- Parameters
-
[in,out] | dest | Subtract subtrahend from this value semi-atomically in-place |
[in] | subtrahend | Value to subtract from dest |
Definition at line 961 of file atomic_utils.h.
◆ semi_atomic_fetch_xor_u16()
static void semi_atomic_fetch_xor_u16 |
( |
uint16_t * |
dest, |
|
|
uint16_t |
val |
|
) |
| |
|
inlinestatic |
Semi-atomic version of *dest ^= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest ^ val |
[in] | val | Value to bitwise xor into dest in-place |
Definition at line 1053 of file atomic_utils.h.
◆ semi_atomic_fetch_xor_u32()
static void semi_atomic_fetch_xor_u32 |
( |
uint32_t * |
dest, |
|
|
uint32_t |
val |
|
) |
| |
|
inlinestatic |
Semi-atomic version of *dest ^= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest ^ val |
[in] | val | Value to bitwise xor into dest in-place |
Definition at line 1063 of file atomic_utils.h.
◆ semi_atomic_fetch_xor_u64()
static void semi_atomic_fetch_xor_u64 |
( |
uint64_t * |
dest, |
|
|
uint64_t |
val |
|
) |
| |
|
inlinestatic |
Semi-atomic version of *dest ^= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest ^ val |
[in] | val | Value to bitwise xor into dest in-place |
Definition at line 1073 of file atomic_utils.h.
◆ semi_atomic_fetch_xor_u8()
static void semi_atomic_fetch_xor_u8 |
( |
uint8_t * |
dest, |
|
|
uint8_t |
val |
|
) |
| |
|
inlinestatic |
Semi-atomic version of *dest ^= val
- Parameters
-
[in,out] | dest | Replace this value with the result of *dest ^ val |
[in] | val | Value to bitwise xor into dest in-place |
Definition at line 1043 of file atomic_utils.h.