C Programming/stdatomic.h

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Summary[edit]

The stdatomic.h header defines several macros and declares several types and functions for performing atomic operations on data shared between threads.

Function Overview[edit]

Initialization
atomic_init initializes an atomic object
Fences
atomic_thread_fence
atomic_signal_fence
Lock-Free Property
atomic_is_lock_free indicates whether or not an atomic object is lock-free
Operations
atomic_store replaces the value of an atomic object
atomic_load returns the value of an atomic object
atomic_exchange replaces and returns the value of an atomic object
atomic_compare_exchange_strong
atomic_compare_exchange_weak
atomic_fetch_key
atomic_flag_test_and_set
atomic_flag_clear