Header Reference: <atomic>
Header Reference: <atomic>
Atomic types, atomic references, fences, waits, and memory-ordering facilities from <atomic>.
Header Reference: <atomic>
Atomic types, atomic references, fences, waits, and memory-ordering facilities from <atomic>.
Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.
Header reference pages are meant to answer a practical question quickly: what this header provides, when to reach for it, and which usage rules are easiest to get wrong.
<atomic>std::atomic<T>std::atomic_flagstd::atomic_ref<T>std::memory_orderstd::atomic_thread_fencestd::atomic_signal_fenceUse <atomic> for lock-free or low-lock shared state coordination when a full mutex-based critical section is unnecessary or too costly.
#include <atomic>
int main() {
std::atomic<int> counter{0};
counter.fetch_add(1, std::memory_order_relaxed);
return counter.load(std::memory_order_relaxed);
}