stdatomic
Stdatomic, as implemented in the C standard library header <stdatomic.h>, provides a portable interface for atomic operations on shared data in multi-threaded programs. It defines atomic types and a set of operations that guarantee atomicity and allow explicit memory ordering. The goal is to enable lock-free synchronization where supported by the platform, or to provide a well-defined fallback otherwise.
Its core concept is the atomic type, declared with the _Atomic qualifier or by the type aliases
Operations include atomic_load and atomic_store for reading and writing, atomic_exchange to replace a value, and atomic_compare_exchange_weak
Memory ordering values include memory_order_relaxed, memory_order_acquire, memory_order_release, memory_order_acq_rel, and memory_order_seq_cst. Seq_cst is the strongest and provides
Portability and performance vary by platform. While many types are lock-free on common architectures, some operations
---