Files
2025-10-25 03:02:53 +03:00

18 KiB

[atomics.syn]

32 Concurrency support library [thread]

32.5 Atomic operations [atomics]

32.5.2 Header synopsis [atomics.syn]

🔗

namespace std {// [atomics.order], order and consistencyenum class memory_order : unspecified; // freestandinginline constexpr memory_order memory_order_relaxed = memory_order::relaxed; // freestandinginline constexpr memory_order memory_order_acquire = memory_order::acquire; // freestandinginline constexpr memory_order memory_order_release = memory_order::release; // freestandinginline constexpr memory_order memory_order_acq_rel = memory_order::acq_rel; // freestandinginline constexpr memory_order memory_order_seq_cst = memory_order::seq_cst; // freestanding}// [atomics.lockfree], lock-free property#define ATOMIC_BOOL_LOCK_FREE unspecified // freestanding#define ATOMIC_CHAR_LOCK_FREE unspecified // freestanding#define ATOMIC_CHAR8_T_LOCK_FREE unspecified // freestanding#define ATOMIC_CHAR16_T_LOCK_FREE unspecified // freestanding#define ATOMIC_CHAR32_T_LOCK_FREE unspecified // freestanding#define ATOMIC_WCHAR_T_LOCK_FREE unspecified // freestanding#define ATOMIC_SHORT_LOCK_FREE unspecified // freestanding#define ATOMIC_INT_LOCK_FREE unspecified // freestanding#define ATOMIC_LONG_LOCK_FREE unspecified // freestanding#define ATOMIC_LLONG_LOCK_FREE unspecified // freestanding#define ATOMIC_POINTER_LOCK_FREE unspecified // freestandingnamespace std {// [atomics.ref.generic], class template atomic_reftemplate struct atomic_ref; // freestanding// [atomics.types.generic], class template atomictemplate struct atomic; // freestanding// [atomics.types.pointer], partial specialization for pointerstemplate struct atomic<T*>; // freestanding// [atomics.nonmembers], non-member functionstemplatebool atomic_is_lock_free(const volatile atomic) noexcept; // freestandingtemplatebool atomic_is_lock_free(const atomic) noexcept; // freestandingtemplatevoid atomic_store(volatile atomic, // freestandingtypename atomic::value_type) noexcept; templateconstexpr void atomic_store(atomic, // freestandingtypename atomic::value_type) noexcept; templatevoid atomic_store_explicit(volatile atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templateconstexpr void atomic_store_explicit(atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; template T atomic_load(const volatile atomic) noexcept; // freestandingtemplateconstexpr T atomic_load(const atomic) noexcept; // freestandingtemplate T atomic_load_explicit(const volatile atomic, memory_order) noexcept; // freestandingtemplateconstexpr T atomic_load_explicit(const atomic, memory_order) noexcept; // freestandingtemplate T atomic_exchange(volatile atomic, // freestandingtypename atomic::value_type) noexcept; templateconstexpr T atomic_exchange(atomic, // freestandingtypename atomic::value_type) noexcept; template T atomic_exchange_explicit(volatile atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templateconstexpr T atomic_exchange_explicit(atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templatebool atomic_compare_exchange_weak(volatile atomic, // freestandingtypename atomic::value_type, typename atomic::value_type) noexcept; templateconstexpr bool atomic_compare_exchange_weak(atomic, // freestandingtypename atomic::value_type, typename atomic::value_type) noexcept; templatebool atomic_compare_exchange_strong(volatile atomic, // freestandingtypename atomic::value_type, typename atomic::value_type) noexcept; templateconstexpr bool atomic_compare_exchange_strong(atomic, // freestandingtypename atomic::value_type, typename atomic::value_type) noexcept; templatebool atomic_compare_exchange_weak_explicit(volatile atomic, // freestandingtypename atomic::value_type, typename atomic::value_type, memory_order, memory_order) noexcept; templateconstexpr bool atomic_compare_exchange_weak_explicit(atomic, // freestandingtypename atomic::value_type, typename atomic::value_type, memory_order, memory_order) noexcept; templatebool atomic_compare_exchange_strong_explicit(volatile atomic, // freestandingtypename atomic::value_type, typename atomic::value_type, memory_order, memory_order) noexcept; templateconstexpr bool atomic_compare_exchange_strong_explicit(atomic, // freestandingtypename atomic::value_type, typename atomic::value_type, memory_order, memory_order) noexcept; template T atomic_fetch_add(volatile atomic, // freestandingtypename atomic::difference_type) noexcept; templateconstexpr T atomic_fetch_add(atomic, // freestandingtypename atomic::difference_type) noexcept; template T atomic_fetch_add_explicit(volatile atomic, // freestandingtypename atomic::difference_type, memory_order) noexcept; templateconstexpr T atomic_fetch_add_explicit(atomic, // freestandingtypename atomic::difference_type, memory_order) noexcept; template T atomic_fetch_sub(volatile atomic, // freestandingtypename atomic::difference_type) noexcept; templateconstexpr T atomic_fetch_sub(atomic, // freestandingtypename atomic::difference_type) noexcept; template T atomic_fetch_sub_explicit(volatile atomic, // freestandingtypename atomic::difference_type, memory_order) noexcept; templateconstexpr T atomic_fetch_sub_explicit(atomic, // freestandingtypename atomic::difference_type, memory_order) noexcept; template T atomic_fetch_and(volatile atomic, // freestandingtypename atomic::value_type) noexcept; templateconstexpr T atomic_fetch_and(atomic, // freestandingtypename atomic::value_type) noexcept; template T atomic_fetch_and_explicit(volatile atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templateconstexpr T atomic_fetch_and_explicit(atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; template T atomic_fetch_or(volatile atomic, // freestandingtypename atomic::value_type) noexcept; templateconstexpr T atomic_fetch_or(atomic, // freestandingtypename atomic::value_type) noexcept; template T atomic_fetch_or_explicit(volatile atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templateconstexpr T atomic_fetch_or_explicit(atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; template T atomic_fetch_xor(volatile atomic, // freestandingtypename atomic::value_type) noexcept; templateconstexpr T atomic_fetch_xor(atomic, // freestandingtypename atomic::value_type) noexcept; template T atomic_fetch_xor_explicit(volatile atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templateconstexpr T atomic_fetch_xor_explicit(atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; template T atomic_fetch_max(volatile atomic, // freestandingtypename atomic::value_type) noexcept; templateconstexpr T atomic_fetch_max(atomic, // freestandingtypename atomic::value_type) noexcept; template T atomic_fetch_max_explicit(volatile atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templateconstexpr T atomic_fetch_max_explicit(atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; template T atomic_fetch_min(volatile atomic, // freestandingtypename atomic::value_type) noexcept; templateconstexpr T atomic_fetch_min(atomic, // freestandingtypename atomic::value_type) noexcept; template T atomic_fetch_min_explicit(volatile atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templateconstexpr T atomic_fetch_min_explicit(atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templatevoid atomic_store_add(volatile atomic, // freestandingtypename atomic::difference_type) noexcept; templateconstexpr void atomic_store_add(atomic, // freestandingtypename atomic::difference_type) noexcept; templatevoid atomic_store_add_explicit(volatile atomic, // freestandingtypename atomic::difference_type, memory_order) noexcept; templateconstexpr void atomic_store_add_explicit(atomic, // freestandingtypename atomic::difference_type, memory_order) noexcept; templatevoid atomic_store_sub(volatile atomic, // freestandingtypename atomic::difference_type) noexcept; templateconstexpr void atomic_store_sub(atomic, // freestandingtypename atomic::difference_type) noexcept; templatevoid atomic_store_sub_explicit(volatile atomic, // freestandingtypename atomic::difference_type, memory_order) noexcept; templateconstexpr void atomic_store_sub_explicit(atomic, // freestandingtypename atomic::difference_type, memory_order) noexcept; templatevoid atomic_store_and(volatile atomic, // freestandingtypename atomic::value_type) noexcept; templateconstexpr void atomic_store_and(atomic, // freestandingtypename atomic::value_type) noexcept; templatevoid atomic_store_and_explicit(volatile atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templateconstexpr void atomic_store_and_explicit(atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templatevoid atomic_store_or(volatile atomic, // freestandingtypename atomic::value_type) noexcept; templateconstexpr void atomic_store_or(atomic, // freestandingtypename atomic::value_type) noexcept; templatevoid atomic_store_or_explicit(volatile atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templateconstexpr void atomic_store_or_explicit(atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templatevoid atomic_store_xor(volatile atomic, // freestandingtypename atomic::value_type) noexcept; templateconstexpr void atomic_store_xor(atomic, // freestandingtypename atomic::value_type) noexcept; templatevoid atomic_store_xor_explicit(volatile atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templateconstexpr void atomic_store_xor_explicit(atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templatevoid atomic_store_max(volatile atomic, // freestandingtypename atomic::value_type) noexcept; templateconstexpr void atomic_store_max(atomic, // freestandingtypename atomic::value_type) noexcept; templatevoid atomic_store_max_explicit(volatile atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templateconstexpr void atomic_store_max_explicit(atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templatevoid atomic_store_min(volatile atomic, // freestandingtypename atomic::value_type) noexcept; templateconstexpr void atomic_store_min(atomic, // freestandingtypename atomic::value_type) noexcept; templatevoid atomic_store_min_explicit(volatile atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templateconstexpr void atomic_store_min_explicit(atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templatevoid atomic_wait(const volatile atomic, // freestandingtypename atomic::value_type) noexcept; templateconstexpr void atomic_wait(const atomic, // freestandingtypename atomic::value_type) noexcept; templatevoid atomic_wait_explicit(const volatile atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templateconstexpr void atomic_wait_explicit(const atomic, // freestandingtypename atomic::value_type, memory_order) noexcept; templatevoid atomic_notify_one(volatile atomic) noexcept; // freestandingtemplateconstexpr void atomic_notify_one(atomic) noexcept; // freestandingtemplatevoid atomic_notify_all(volatile atomic) noexcept; // freestandingtemplateconstexpr void atomic_notify_all(atomic) noexcept; // freestanding// [atomics.alias], type aliasesusing atomic_bool = atomic; // freestandingusing atomic_char = atomic; // freestandingusing atomic_schar = atomic; // freestandingusing atomic_uchar = atomic; // freestandingusing atomic_short = atomic; // freestandingusing atomic_ushort = atomic; // freestandingusing atomic_int = atomic; // freestandingusing atomic_uint = atomic; // freestandingusing atomic_long = atomic; // freestandingusing atomic_ulong = atomic; // freestandingusing atomic_llong = atomic; // freestandingusing atomic_ullong = atomic; // freestandingusing atomic_char8_t = atomic<char8_t>; // freestandingusing atomic_char16_t = atomic<char16_t>; // freestandingusing atomic_char32_t = atomic<char32_t>; // freestandingusing atomic_wchar_t = atomic<wchar_t>; // freestandingusing atomic_int8_t = atomic<int8_t>; // freestandingusing atomic_uint8_t = atomic<uint8_t>; // freestandingusing atomic_int16_t = atomic<int16_t>; // freestandingusing atomic_uint16_t = atomic<uint16_t>; // freestandingusing atomic_int32_t = atomic<int32_t>; // freestandingusing atomic_uint32_t = atomic<uint32_t>; // freestandingusing atomic_int64_t = atomic<int64_t>; // freestandingusing atomic_uint64_t = atomic<uint64_t>; // freestandingusing atomic_int_least8_t = atomic<int_least8_t>; // freestandingusing atomic_uint_least8_t = atomic<uint_least8_t>; // freestandingusing atomic_int_least16_t = atomic<int_least16_t>; // freestandingusing atomic_uint_least16_t = atomic<uint_least16_t>; // freestandingusing atomic_int_least32_t = atomic<int_least32_t>; // freestandingusing atomic_uint_least32_t = atomic<uint_least32_t>; // freestandingusing atomic_int_least64_t = atomic<int_least64_t>; // freestandingusing atomic_uint_least64_t = atomic<uint_least64_t>; // freestandingusing atomic_int_fast8_t = atomic<int_fast8_t>; // freestandingusing atomic_uint_fast8_t = atomic<uint_fast8_t>; // freestandingusing atomic_int_fast16_t = atomic<int_fast16_t>; // freestandingusing atomic_uint_fast16_t = atomic<uint_fast16_t>; // freestandingusing atomic_int_fast32_t = atomic<int_fast32_t>; // freestandingusing atomic_uint_fast32_t = atomic<uint_fast32_t>; // freestandingusing atomic_int_fast64_t = atomic<int_fast64_t>; // freestandingusing atomic_uint_fast64_t = atomic<uint_fast64_t>; // freestandingusing atomic_intptr_t = atomic<intptr_t>; // freestandingusing atomic_uintptr_t = atomic<uintptr_t>; // freestandingusing atomic_size_t = atomic<size_t>; // freestandingusing atomic_ptrdiff_t = atomic<ptrdiff_t>; // freestandingusing atomic_intmax_t = atomic<intmax_t>; // freestandingusing atomic_uintmax_t = atomic<uintmax_t>; // freestandingusing atomic_signed_lock_free = see below; using atomic_unsigned_lock_free = see below; // [atomics.flag], flag type and operationsstruct atomic_flag; // freestandingbool atomic_flag_test(const volatile atomic_flag*) noexcept; // freestandingconstexpr bool atomic_flag_test(const atomic_flag*) noexcept; // freestandingbool atomic_flag_test_explicit(const volatile atomic_flag*, // freestanding memory_order) noexcept; constexpr bool atomic_flag_test_explicit(const atomic_flag*, // freestanding memory_order) noexcept; bool atomic_flag_test_and_set(volatile atomic_flag*) noexcept; // freestandingconstexpr bool atomic_flag_test_and_set(atomic_flag*) noexcept; // freestandingbool atomic_flag_test_and_set_explicit(volatile atomic_flag*, // freestanding memory_order) noexcept; constexpr bool atomic_flag_test_and_set_explicit(atomic_flag*, // freestanding memory_order) noexcept; void atomic_flag_clear(volatile atomic_flag*) noexcept; // freestandingconstexpr void atomic_flag_clear(atomic_flag*) noexcept; // freestandingvoid atomic_flag_clear_explicit(volatile atomic_flag*, memory_order) noexcept; // freestandingconstexpr void atomic_flag_clear_explicit(atomic_flag*, memory_order) noexcept; // freestandingvoid atomic_flag_wait(const volatile atomic_flag*, bool) noexcept; // freestandingconstexpr void atomic_flag_wait(const atomic_flag*, bool) noexcept; // freestandingvoid atomic_flag_wait_explicit(const volatile atomic_flag*, // freestandingbool, memory_order) noexcept; constexpr void atomic_flag_wait_explicit(const atomic_flag*, // freestandingbool, memory_order) noexcept; void atomic_flag_notify_one(volatile atomic_flag*) noexcept; // freestandingconstexpr void atomic_flag_notify_one(atomic_flag*) noexcept; // freestandingvoid atomic_flag_notify_all(volatile atomic_flag*) noexcept; // freestandingconstexpr void atomic_flag_notify_all(atomic_flag*) noexcept; // freestanding#define ATOMIC_FLAG_INIT see below // freestanding// [atomics.fences], fencesextern "C" constexpr void atomic_thread_fence(memory_order) noexcept; // freestandingextern "C" constexpr void atomic_signal_fence(memory_order) noexcept; // freestanding}