atomic_signal_fence()
Fence between a thread and a signal handler executed in the same thread (C11)
Synopsis:
#include <stdatomic.h>
void atomic_signal_fence( memory_order order );
Arguments:
- order
- The memory_order to use for the fence.
Library:
- If the atomic function is lock-free (see atomic_is_lock_free()), no extra library is required.
- If the function isn't lock-free, you need to link against libatomic. Use the -l atomic option to qcc to link against this library.
Description:
The atomic_signal_fence() function establishes a memory-synchronization ordering of non-atomic and relaxed atomic accesses, as instructed by order, between a thread and a signal handler executed on the same thread. Only reordering of the instructions by the compiler is suppressed as order instructs. For example, writes can't be moved past a fence with release semantics, and reads can't be moved ahead of a fence with acquire semantics.
The implementation of atomic functions may depend on the architecture.
For more information, see
LL/SC vs LSE atomic operations
in the description in Building Embedded Systems of the cpuinfo area of the system page.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Read the Caveats |
Thread | Yes |
Caveats:
If this function is lock-free (see atomic_is_lock_free()), it's safe to call it from a signal handler.