Atomically XOR a value into an atomic object (C11)
#include <stdatomic.h>
C atomic_fetch_xor( volatile A *obj,
M arg );
C atomic_fetch_xor_explicit( volatile A *obj,
M arg,
memory_order order );
The atomic_fetch_xor() and atomic_fetch_xor_explicit() functions are generic functions that atomically XOR the given value in to the given atomic object. The atomic_fetch_xor() function orders memory access according to memory_order_seq_cst; atomic_fetch_xor_explicit() orders them as specified by order.
The previous value of the atomic object. The C represents the non-atomic data type that corresponds to the atomic object.
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | Read the Caveats |
| Signal handler | Read the Caveats |
| Thread | Yes |
If this function is lock-free (see atomic_is_lock_free()), it's safe to call it from an ISR or signal handler.