标准库头文件 <stdatomic.h>
来自 cppreference.com
该头文件最初位于 C 标准库中。
该头文件是 并发支持 库的一部分。
<stdatomic.h>
在命名空间 std
中是否提供任何声明是不确定的。
宏 | ||
(C++23) |
兼容性宏,使得 _Atomic(T) 等同于 std::atomic<T> (函数宏) | |
(C++11) |
将 std::atomic_flag 初始化为 false (宏常量) | |
类型 | ||
(C++11) |
无锁布尔原子类型 (类) | |
(C++11) |
定义给定原子操作的内存排序约束 (枚举) | |
(C++11) |
std::atomic<bool> (typedef) | |
(C++11) |
std::atomic<char> (typedef) | |
(C++11) |
std::atomic<signed char> (typedef) | |
(C++11) |
std::atomic<unsigned char> (typedef) | |
(C++11) |
std::atomic<short> (typedef) | |
(C++11) |
std::atomic<unsigned short> (typedef) | |
(C++11) |
std::atomic<int> (typedef) | |
(C++11) |
std::atomic<unsigned int> (typedef) | |
(C++11) |
std::atomic<long> (typedef) | |
(C++11) |
std::atomic<unsigned long> (typedef) | |
(C++11) |
std::atomic<long long> (typedef) | |
(C++11) |
std::atomic<unsigned long long> (typedef) | |
(C++20) |
std::atomic<char8_t> (typedef) | |
(C++11) |
std::atomic<char16_t> (typedef) | |
(C++11) |
std::atomic<char32_t> (typedef) | |
(C++11) |
std::atomic<wchar_t> (typedef) | |
(C++11)(可选) |
std::atomic<std::int8_t> (typedef) | |
(C++11)(可选) |
std::atomic<std::uint8_t> (typedef) | |
(C++11)(可选) |
std::atomic<std::int16_t> (typedef) | |
(C++11)(可选) |
std::atomic<std::uint16_t> (typedef) | |
(C++11)(可选) |
std::atomic<std::int32_t> (typedef) | |
(C++11)(可选) |
std::atomic<std::uint32_t> (typedef) | |
(C++11)(可选) |
std::atomic<std::int64_t> (typedef) | |
(C++11)(可选) |
std::atomic<std::uint64_t> (typedef) | |
(C++11) |
std::atomic<std::int_least8_t> (typedef) | |
(C++11) |
std::atomic<std::uint_least8_t> (typedef) | |
(C++11) |
std::atomic<std::int_least16_t> (typedef) | |
(C++11) |
std::atomic<std::uint_least16_t> (typedef) | |
(C++11) |
std::atomic<std::int_least32_t> (typedef) | |
(C++11) |
std::atomic<std::uint_least32_t> (typedef) | |
(C++11) |
std::atomic<std::int_least64_t> (typedef) | |
(C++11) |
std::atomic<std::uint_least64_t> (typedef) | |
(C++11) |
std::atomic<std::int_fast8_t> (typedef) | |
(C++11) |
std::atomic<std::uint_fast8_t> (typedef) | |
(C++11) |
std::atomic<std::int_fast16_t> (typedef) | |
(C++11) |
std::atomic<std::uint_fast16_t> (typedef) | |
(C++11) |
std::atomic<std::int_fast32_t> (typedef) | |
(C++11) |
std::atomic<std::uint_fast32_t> (typedef) | |
(C++11) |
std::atomic<std::int_fast64_t> (typedef) | |
(C++11) |
std::atomic<std::uint_fast64_t> (typedef) | |
(C++11)(可选) |
std::atomic<std::intptr_t> (typedef) | |
(C++11)(可选) |
std::atomic<std::uintptr_t> (typedef) | |
(C++11) |
std::atomic<std::size_t> (typedef) | |
(C++11) |
std::atomic<std::ptrdiff_t> (typedef) | |
(C++11) |
std::atomic<std::intmax_t> (typedef) | |
(C++11) |
std::atomic<std::uintmax_t> (typedef) | |
函数 | ||
(C++11) |
检查原子类型的操作是否无锁 (函数模板) | |
(C++11)(C++11) |
原子地将原子对象的 value 值替换为非原子参数 (函数模板) | |
(C++11)(C++11) |
原子地获取存储在原子对象中的 value 值 (函数模板) | |
(C++11)(C++11) |
原子地将原子对象的 value 值替换为非原子参数,并返回原子对象的旧 value 值 (函数模板) | |
原子地将原子对象的 value 值与非原子参数进行比较,如果相等则执行原子交换,否则执行原子加载 (函数模板) | ||
(C++11)(C++11) |
将一个非原子值添加到一个原子对象,并获取原子对象的先前值。 (函数模板) | |
(C++11)(C++11) |
从原子对象中减去一个非原子值,并获取原子对象的先前值。 (函数模板) | |
(C++11)(C++11) |
用与非原子参数进行按位与运算的结果替换原子对象,并获取原子对象的先前值。 (函数模板) | |
(C++11)(C++11) |
用与非原子参数进行按位或运算的结果替换原子对象,并获取原子对象的先前值。 (函数模板) | |
(C++11)(C++11) |
用与非原子参数进行按位异或运算的结果替换原子对象,并获取原子对象的先前值。 (函数模板) | |
原子地将标志设置为 true 并返回其先前值。 (函数) | ||
(C++11)(C++11) |
原子地将标志的值设置为 false。 (函数) | |
(C++11) |
通用内存顺序依赖栅栏同步原语。 (函数) | |
(C++11) |
线程与其在同一线程中执行的信号处理程序之间的栅栏。 (函数) |
[编辑] 概要
template<class T> using __std_atomic = std::atomic<T>; // exposition only #define _Atomic(T) __std_atomic<T> #define ATOMIC_BOOL_LOCK_FREE /* see description */ #define ATOMIC_CHAR_LOCK_FREE /* see description */ #define ATOMIC_CHAR16_T_LOCK_FREE /* see description */ #define ATOMIC_CHAR32_T_LOCK_FREE /* see description */ #define ATOMIC_WCHAR_T_LOCK_FREE /* see description */ #define ATOMIC_SHORT_LOCK_FREE /* see description */ #define ATOMIC_INT_LOCK_FREE /* see description */ #define ATOMIC_LONG_LOCK_FREE /* see description */ #define ATOMIC_LLONG_LOCK_FREE /* see description */ #define ATOMIC_POINTER_LOCK_FREE /* see description */ using std::memory_order; // see description using std::memory_order_relaxed; // see description using std::memory_order_consume; // see description using std::memory_order_acquire; // see description using std::memory_order_release; // see description using std::memory_order_acq_rel; // see description using std::memory_order_seq_cst; // see description using std::atomic_flag; // see description using std::atomic_bool; // see description using std::atomic_char; // see description using std::atomic_schar; // see description using std::atomic_uchar; // see description using std::atomic_short; // see description using std::atomic_ushort; // see description using std::atomic_int; // see description using std::atomic_uint; // see description using std::atomic_long; // see description using std::atomic_ulong; // see description using std::atomic_llong; // see description using std::atomic_ullong; // see description using std::atomic_char8_t; // see description using std::atomic_char16_t; // see description using std::atomic_char32_t; // see description using std::atomic_wchar_t; // see description using std::atomic_int8_t; // see description using std::atomic_uint8_t; // see description using std::atomic_int16_t; // see description using std::atomic_uint16_t; // see description using std::atomic_int32_t; // see description using std::atomic_uint32_t; // see description using std::atomic_int64_t; // see description using std::atomic_uint64_t; // see description using std::atomic_int_least8_t; // see description using std::atomic_uint_least8_t; // see description using std::atomic_int_least16_t; // see description using std::atomic_uint_least16_t; // see description using std::atomic_int_least32_t; // see description using std::atomic_uint_least32_t; // see description using std::atomic_int_least64_t; // see description using std::atomic_uint_least64_t; // see description using std::atomic_int_fast8_t; // see description using std::atomic_uint_fast8_t; // see description using std::atomic_int_fast16_t; // see description using std::atomic_uint_fast16_t; // see description using std::atomic_int_fast32_t; // see description using std::atomic_uint_fast32_t; // see description using std::atomic_int_fast64_t; // see description using std::atomic_uint_fast64_t; // see description using std::atomic_intptr_t; // see description using std::atomic_uintptr_t; // see description using std::atomic_size_t; // see description using std::atomic_ptrdiff_t; // see description using std::atomic_intmax_t; // see description using std::atomic_uintmax_t; // see description using std::atomic_is_lock_free; // see description using std::atomic_load; // see description using std::atomic_load_explicit; // see description using std::atomic_store; // see description using std::atomic_store_explicit; // see description using std::atomic_exchange; // see description using std::atomic_exchange_explicit; // see description using std::atomic_compare_exchange_strong; // see description using std::atomic_compare_exchange_strong_explicit; // see description using std::atomic_compare_exchange_weak; // see description using std::atomic_compare_exchange_weak_explicit; // see description using std::atomic_fetch_add; // see description using std::atomic_fetch_add_explicit; // see description using std::atomic_fetch_sub; // see description using std::atomic_fetch_sub_explicit; // see description using std::atomic_fetch_or; // see description using std::atomic_fetch_or_explicit; // see description using std::atomic_fetch_xor; // see description using std::atomic_fetch_xor_explicit; // see description using std::atomic_fetch_and; // see description using std::atomic_fetch_and_explicit; // see description using std::atomic_flag_test_and_set; // see description using std::atomic_flag_test_and_set_explicit; // see description using std::atomic_flag_clear; // see description using std::atomic_flag_clear_explicit; // see description #define ATOMIC_FLAG_INIT /* see description */ using std::atomic_thread_fence; // see description using std::atomic_signal_fence; // see description