atomic
标准库标头<atomic>
此标头是原子运算图书馆。
班
*。
原子%28C++11%29原子类模板以及bool、整型和指针类型的专门化%28类模板%29
原子[医]标志%28C++11%29无锁布尔原子类型%28类%29
记忆[医]Order%28C++11%29定义给定原子操作的内存排序约束
台培
STD::原子[医]Bool STD::原子<bool>
STD::原子[医]前言STD::原子<char>
STD::原子[医]Schar STD::原子<signed char>
STD::原子[医]uchar STD::原子<unsigned char>
STD::原子[医]简短的STD::原子<short>
STD::原子[医]ushort STD::原子<unsigned short>
STD::原子[医]INT STD::原子<int>
STD::原子[医]UINT STD::原子<unsigned int>
STD::原子[医]长STD::原子<long>
STD::原子[医]Ulong STD::原子<unsigned long>
STD::原子[医]Llong STD::原子<long long>
STD::原子[医]ULLONG STD::原子<unsigned long long>
STD::原子[医]char16[医]T STD::原子<char16[医]T>
STD::原子[医]查32[医]t std::原子<char32[医]T>
STD::原子[医]Wchar[医]t std::原子<wchar[医]T>
STD::原子[医]INT[医]最少8[医]t std::原子<int[医]最少8[医]T>
STD::原子[医]温特[医]最少8[医]t std::原子<uint[医]最少8[医]T>
STD::原子[医]INT[医]至少16[医]t std::原子<int[医]至少16[医]T>
STD::原子[医]温特[医]至少16[医]t std::原子<uint[医]至少16[医]T>
STD::原子[医]INT[医]至少32[医]t std::原子<int[医]至少32[医]T>
STD::原子[医]温特[医]至少32[医]t std::原子<uint[医]至少32[医]T>
STD::原子[医]INT[医]至少64[医]t std::原子<int[医]至少64[医]T>
STD::原子[医]温特[医]至少64[医]t std::原子<uint[医]至少64[医]T>
STD::原子[医]INT[医]快8[医]t std::原子<int[医]快8[医]T>
STD::原子[医]温特[医]快8[医]t std::原子<uint[医]快8[医]T>
STD::原子[医]INT[医]扣件16[医]t std::原子<int[医]扣件16[医]T>
STD::原子[医]温特[医]扣件16[医]t std::原子<uint[医]扣件16[医]T>
STD::原子[医]INT[医]扣件32[医]t std::原子<int[医]扣件32[医]T>
STD::原子[医]温特[医]扣件32[医]t std::原子<uint[医]扣件32[医]T>
STD::原子[医]INT[医]快64[医]t std::原子<int[医]快64[医]T>
STD::原子[医]温特[医]快64[医]t std::原子<uint[医]快64[医]T>
STD::原子[医]intptr[医]t std::原子<intptr[医]T>
STD::原子[医]尤因普特[医]t std::原子<uintptr[医]T>
STD::原子[医]大小[医]T STD::原子<大小[医]T>
STD::原子[医]ptrdiff[医]t std::原子<ptrdiff[医]T>
STD::原子[医]最大[医]t std::原子<intmax[医]T>
STD::原子[医]温特马克斯[医]T STD::原子<uintmax[医]T>
功能
原子[医]是[医]锁[医]空闲%28C++11%29检查原子类型%27s操作是否为无锁的%28函数模板%29
原子[医]存储原子[医]商店[医]显式%28C++11%29%28C++11%29原子化用非原子参数%28函数模板%29替换原子对象的值。
原子[医]负载原子[医]负载[医]显式%28C++11%29%28C++11%29原子地获得存储在原子对象%28函数模板%29中的值
原子[医]交换原子[医]交换[医]显式%28C++11%29%28C++11%29原子化地用非原子参数替换原子对象的值,并返回原子%28函数模板%29的旧值。
原子[医]比较[医]交换[医]弱原子[医]比较[医]交换[医]弱[医]说明性[医]比较[医]交换[医]强原子[医]比较[医]交换[医]强[医]显式%28C++11%29%28C+11%29%28C++11%29%28C+11%29原子地比较原子对象的值和非原子参数,如果相等则执行原子交换,如果不等于则执行原子负载。
原子[医]去取[医]附加体[医]去取[医]加[医]显式%28C++11%29%28C++11%29向原子对象添加一个非原子值,并获得原子%28函数模板%29的先前值。
原子[医]去取[医]亚原子[医]去取[医]分[医]显式%28C++11%29%28C++11%29从原子对象中减去一个非原子值,并获得原子%28函数模板%29的先前值。
原子[医]去取[医]无体[医]去取[医]和[医]显式%28C++11%29%28C++11%29用逻辑结果和非原子参数替换原子对象,并获得原子%28函数模板%29的先前值。
原子[医]去取[医]奥原子[医]去取[医]或[医]显式%28C++11%29%28C++11%29用非原子参数替换逻辑OR的结果,并获得原子%28函数模板%29的先前值。
原子[医]去取[医]异原子[医]去取[医]异或[医]显式%28C++11%29%28C++11%29用非原子参数替换逻辑异或结果的原子对象,并获得原子%28函数模板%29的先前值。
原子[医]旗子[医]试验[医]和[医]集原子[医]旗子[医]试验[医]和[医]集[医]显式%28C++11%29%28C++11%29原子地将标志设置为true并返回其以前的值%28函数%29
原子[医]旗子[医]清晰原子[医]旗子[医]清澈[医]显式%28C++11%29%28C++11%29原子地将标志的值设置为假%28函数%29
原子[医]默认构造的原子对象%28函数模板%29的init%28c++11%29非原子初始化
杀[医]依赖性%28C++11%29从std::内存中删除指定的对象[医]命令[医]使用依赖树%28函数模板%29
原子[医]螺纹[医]Fence%28C++11%29通用内存顺序相关的FRAF同步原语%28功能%29
原子[医]信号[医]在同一线程中执行的线程和信号处理程序之间的Fence%28C++11%29栅栏%28功能%29
预处理宏
原子[医]瓦尔[医]静态存储时间的原子变量的INIT%28C++11%29常量初始化%28函数宏%29
原子[医]旗子[医]init%28C++11%29初始化std::原子[医]标志为false%28宏常量%29
简介
二次
namespace std {
typedef enum memory_order {
memory_order_relaxed,
memory_order_consume,
memory_order_acquire,
memory_order_release,
memory_order_acq_rel,
memory_order_seq_cst
} memory_order;
template <class T>
T kill_dependency(T y) noexcept;
// lock-free property
#define ATOMIC_BOOL_LOCK_FREE /*unspecified*/
#define ATOMIC_CHAR_LOCK_FREE /*unspecified*/
#define ATOMIC_CHAR16_T_LOCK_FREE /*unspecified*/
#define ATOMIC_CHAR32_T_LOCK_FREE /*unspecified*/
#define ATOMIC_WCHAR_T_LOCK_FREE /*unspecified*/
#define ATOMIC_SHORT_LOCK_FREE /*unspecified*/
#define ATOMIC_INT_LOCK_FREE /*unspecified*/
#define ATOMIC_LONG_LOCK_FREE /*unspecified*/
#define ATOMIC_LLONG_LOCK_FREE /*unspecified*/
#define ATOMIC_POINTER_LOCK_FREE /*unspecified*/
// generic atomic type
template<class T> struct atomic;
// specialization for integral types
template<> struct atomic</*integral*/>;
// specialization for pointers
template<class T> struct atomic<T*>;
// named typedefs
typedef atomic<bool> atomic_bool;
typedef atomic<char> atomic_char;
typedef atomic<signed char> atomic_schar;
typedef atomic<unsigned char> atomic_uchar;
typedef atomic<short> atomic_short;
typedef atomic<unsigned short> atomic_ushort;
typedef atomic<int> atomic_int;
typedef atomic<unsigned int> atomic_uint;
typedef atomic<long> atomic_long;
typedef atomic<unsigned long> atomic_ulong;
typedef atomic<long long> atomic_llong;
typedef atomic<unsigned long long> atomic_ullong;
typedef atomic<char16_t> atomic_char16_t;
typedef atomic<char32_t> atomic_char32_t;
typedef atomic<wchar_t> atomic_wchar_t;
typedef atomic<int_least8_t> atomic_int_least8_t;
typedef atomic<uint_least8_t> atomic_uint_least8_t;
typedef atomic<int_least16_t> atomic_int_least16_t;
typedef atomic<uint_least16_t> atomic_uint_least16_t;
typedef atomic<int_least32_t> atomic_int_least32_t;
typedef atomic<uint_least32_t> atomic_uint_least32_t;
typedef atomic<int_least64_t> atomic_int_least64_t;
typedef atomic<uint_least64_t> atomic_uint_least64_t;
typedef atomic<int_fast8_t> atomic_int_fast8_t;
typedef atomic<uint_fast8_t> atomic_uint_fast8_t;
typedef atomic<int_fast16_t> atomic_int_fast16_t;
typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
typedef atomic<int_fast32_t> atomic_int_fast32_t;
typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
typedef atomic<int_fast64_t> atomic_int_fast64_t;
typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
typedef atomic<intptr_t> atomic_intptr_t;
typedef atomic<uintptr_t> atomic_uintptr_t;
typedef atomic<size_t> atomic_size_t;
typedef atomic<ptrdiff_t> atomic_ptrdiff_t;
typedef atomic<intmax_t> atomic_intmax_t;
typedef atomic<uintmax_t> atomic_uintmax_t;
// general operations on atomic types
// /*atomic-type*/ is either atomic<T> or one of the typedefs
// (if it's atomic<T>, then template<class T> is implied)
bool atomic_is_lock_free(const volatile /*atomic-type*/ *) noexcept;
bool atomic_is_lock_free(const /*atomic-type*/ *) noexcept;
void atomic_init(volatile /*atomic-type*/ *, T) noexcept;
void atomic_init(/*atomic-type*/ *, T) noexcept;
void atomic_store(volatile /*atomic-type*/ *, T) noexcept;
void atomic_store(/*atomic-type*/ *, T) noexcept;
void atomic_store_explicit(volatile /*atomic-type*/ *, T, memory_order) noexcept;
void atomic_store_explicit(/*atomic-type*/ *, T, memory_order) noexcept;
T atomic_load(const volatile /*atomic-type*/ *) noexcept;
T atomic_load(const /*atomic-type*/ *) noexcept;
T atomic_load_explicit(const volatile /*atomic-type*/ *, memory_order) noexcept;
T atomic_load_explicit(const /*atomic-type*/ *, memory_order) noexcept;
T atomic_exchange(volatile /*atomic-type*/ *, T) noexcept;
T atomic_exchange(/*atomic-type*/ *, T) noexcept;
T atomic_exchange_explicit(volatile /*atomic-type*/ *, T, memory_order) noexcept;
T atomic_exchange_explicit(/*atomic-type*/ *, T, memory_order) noexcept;
bool atomic_compare_exchange_weak(volatile /*atomic-type*/ *, T*, T) noexcept;
bool atomic_compare_exchange_weak(/*atomic-type*/ *, T*, T) noexcept;
bool atomic_compare_exchange_strong(volatile /*atomic-type*/ *, T*, T) noexcept;
bool atomic_compare_exchange_strong(/*atomic-type*/ *, T*, T) noexcept;
bool atomic_compare_exchange_weak_explicit(volatile /*atomic-type*/ *, T*, T,
memory_order, memory_order) noexcept;
bool atomic_compare_exchange_weak_explicit(/*atomic-type*/ *, T*, T.
memory_order, memory_order) noexcept;
bool atomic_compare_exchange_strong_explicit(volatile /*atomic-type*/ *, T*, T,
memory_order, memory_order) noexcept;
bool atomic_compare_exchange_strong_explicit(/*atomic-type*/ *, T*, T,
memory_order, memory_order) noexcept;
// templated operations on atomic types (declared, but not defined)
template <class T>
T atomic_fetch_add(volatile atomic<T>*, T) noexcept;
template <class T>
T atomic_fetch_add(atomic<T>*, T) noexcept;
template <class T>
T atomic_fetch_add_explicit(volatile atomic<T>*, T, memory_order) noexcept;
template <class T>
T atomic_fetch_add_explicit(atomic<T>*, T, memory_order) noexcept;
template <class T>
T atomic_fetch_sub(volatile atomic<T>*, T) noexcept;
template <class T>
T atomic_fetch_sub(atomic<T>*, T) noexcept;
template <class T>
T atomic_fetch_sub_explicit(volatile atomic<T>*, T, memory_order) noexcept;
template <class T>
T atomic_fetch_sub_explicit(atomic<T>*, T, memory_order) noexcept;
template <class T>
T atomic_fetch_and(volatile atomic<T>*, T) noexcept;
template <class T>
T atomic_fetch_and(atomic<T>*, T) noexcept;
template <class T>
T atomic_fetch_and_explicit(volatile atomic<T>*, T, memory_order) noexcept;
template <class T>
T atomic_fetch_and_explicit(atomic<T>*, T, memory_order) noexcept;
template <class T>
T atomic_fetch_or(volatile atomic<T>*, T) noexcept;
template <class T>
T atomic_fetch_or(atomic<T>*, T) noexcept;
template <class T>
T atomic_fetch_or_explicit(volatile atomic<T>*, T, memory_order) noexcept;
template <class T>
T atomic_fetch_or_explicit(atomic<T>*, T, memory_order) noexcept;
template <class T>
T atomic_fetch_xor(volatile atomic<T>*, T) noexcept;
template <class T>
T atomic_fetch_xor(atomic<T>*, T) noexcept;
template <class T>
T atomic_fetch_xor_explicit(volatile atomic<T>*, T, memory_order) noexcept;
template <class T>
T atomic_fetch_xor_explicit(atomic<T>*, T, memory_order) noexcept;
// arithmetic operations on atomic types
// /*atomic-integral*/ is either atomic<T> or one of the typedefs
// (if it's atomic<T>, then template<> is implied)
/*integral*/ atomic_fetch_add(volatile /*atomic-integral*/ *,
/*integral*/ ) noexcept;
/*integral*/ atomic_fetch_add(/*atomic-integral*/ *,
/*integral*/ ) noexcept;
/*integral*/ atomic_fetch_add_explicit(volatile /*atomic-integral*/ *,
/*integral*/,
memory_order) noexcept;
/*integral*/ atomic_fetch_add_explicit(/*atomic-integral*/ *,
/*integral*/,
memory_order) noexcept;
/*integral*/ atomic_fetch_sub(volatile /*atomic-integral*/ *,
/*integral*/ ) noexcept;
/*integral*/ atomic_fetch_sub(/*atomic-integral*/ *,
/*integral*/ ) noexcept;
/*integral*/ atomic_fetch_sub_explicit(volatile /*atomic-integral*/ *,
/*integral*/ ,
memory_order) noexcept;
/*integral*/ atomic_fetch_sub_explicit(/*atomic-integral*/ *,
/*integral*/ ,
memory_order) noexcept;
/*integral*/ atomic_fetch_and(volatile /*atomic-integral*/ *,
/*integral*/ ) noexcept;
/*integral*/ atomic_fetch_and(/*atomic-integral*/ *,
/*integral*/ ) noexcept;
/*integral*/ atomic_fetch_and_explicit(volatile /*atomic-integral*/ *,
/*integral*/ ,
memory_order) noexcept;
/*integral*/ atomic_fetch_and_explicit(/*atomic-integral*/ *,
/*integral*/ ,
memory_order) noexcept;
/*integral*/ atomic_fetch_or(volatile /*atomic-integral*/ *,
/*integral*/ ) noexcept;
/*integral*/ atomic_fetch_or(/*atomic-integral*/ *,
/*integral*/ ) noexcept;
/*integral*/ atomic_fetch_or_explicit(volatile /*atomic-integral*/ *,
/*integral*/ ,
memory_order) noexcept;
/*integral*/ atomic_fetch_or_explicit(/*atomic-integral*/ *,
/*integral*/ ,
memory_order) noexcept;
/*integral*/ atomic_fetch_xor(volatile /*atomic-integral*/ *,
/*integral*/ ) noexcept;
/*integral*/ atomic_fetch_xor(/*atomic-integral*/ *,
/*integral*/ ) noexcept;
/*integral*/ atomic_fetch_xor_explicit(volatile /*atomic-integral*/ *,
/*integral*/ , memory_order) noexcept;
/*integral*/ atomic_fetch_xor_explicit(/*atomic-integral*/ *,
/*integral*/ ,
memory_order) noexcept;
// partial specializations for pointers
template <class T>
T* atomic_fetch_add(volatile atomic<T*>*, ptrdiff_t) noexcept;
template <class T>
T* atomic_fetch_add(atomic<T*>*, ptrdiff_t) noexcept;
template <class T>
T* atomic_fetch_add_explicit(volatile atomic<T*>*,
ptrdiff_t, memory_order) noexcept;
template <class T>
T* atomic_fetch_add_explicit(atomic<T*>*, ptrdiff_t, memory_order) noexcept;
template <class T>
T* atomic_fetch_sub(volatile atomic<T*>*, ptrdiff_t) noexcept;
template <class T>
T* atomic_fetch_sub(atomic<T*>*, ptrdiff_t) noexcept;
template <class T>
T* atomic_fetch_sub_explicit(volatile atomic<T*>*,
ptrdiff_t, memory_order) noexcept;
template <class T>
T* atomic_fetch_sub_explicit(atomic<T*>*, ptrdiff_t, memory_order) noexcept;
// initialization
#define ATOMIC_VAR_INIT(value) /*see description*/
// flag type and operations
struct atomic_flag;
bool atomic_flag_test_and_set(volatile atomic_flag*) noexcept;
bool atomic_flag_test_and_set(atomic_flag*) noexcept;
bool atomic_flag_test_and_set_explicit(volatile atomic_flag*,
memory_order) noexcept;
bool atomic_flag_test_and_set_explicit(atomic_flag*, memory_order) noexcept;
void atomic_flag_clear(volatile atomic_flag*) noexcept;
void atomic_flag_clear(atomic_flag*) noexcept;
void atomic_flag_clear_explicit(volatile atomic_flag*, memory_order) noexcept;
void atomic_flag_clear_explicit(atomic_flag*, memory_order) noexcept;
#define ATOMIC_FLAG_INIT /*see description*/
// fences
extern "C" void atomic_thread_fence(memory_order) noexcept;
extern "C" void atomic_signal_fence(memory_order) noexcept;
二次
类std::atomic
二次
template <class T> struct atomic {
bool is_lock_free() const volatile noexcept;
bool is_lock_free() const noexcept;
void store(T, memory_order = memory_order_seq_cst) volatile noexcept;
void store(T, memory_order = memory_order_seq_cst) noexcept;
T load(memory_order = memory_order_seq_cst) const volatile noexcept;
T load(memory_order = memory_order_seq_cst) const noexcept;
operator T() const volatile noexcept;
operator T() const noexcept;
T exchange(T, memory_order = memory_order_seq_cst) volatile noexcept;
T exchange(T, memory_order = memory_order_seq_cst) noexcept;
bool compare_exchange_weak(T&, T,
memory_order, memory_order) volatile noexcept;
bool compare_exchange_weak(T&, T,
memory_order, memory_order) noexcept;
bool compare_exchange_strong(T&, T,
memory_order, memory_order) volatile noexcept;
bool compare_exchange_strong(T&, T,
memory_order, memory_order) noexcept;
bool compare_exchange_weak(T&, T,
memory_order = memory_order_seq_cst) volatile noexcept;
bool compare_exchange_weak(T&, T,
memory_order = memory_order_seq_cst) noexcept;
bool compare_exchange_strong(T&, T,
memory_order = memory_order_seq_cst) volatile noexcept;
bool compare_exchange_strong(T&, T,
memory_order = memory_order_seq_cst) noexcept;
atomic() noexcept = default;
constexpr atomic(T) noexcept;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
T operator=(T) volatile noexcept;
T operator=(T) noexcept;
};
二次
专业化std::atomic关于积分类型
二次
template<> struct atomic</*integral*/> {
bool is_lock_free() const volatile noexcept;
bool is_lock_free() const noexcept;
void store(/*integral*/,
memory_order = memory_order_seq_cst) volatile noexcept;
void store(/*integral*/,
memory_order = memory_order_seq_cst) noexcept;
/*integral*/ load(memory_order = memory_order_seq_cst) const volatile noexcept;
/*integral*/ load(memory_order = memory_order_seq_cst) const noexcept;
operator /*integral*/() const volatile noexcept;
operator /*integral*/() const noexcept;
/*integral*/ exchange(/*integral*/,
memory_order = memory_order_seq_cst) volatile noexcept;
/*integral*/ exchange(/*integral*/,
memory_order = memory_order_seq_cst) noexcept;
bool compare_exchange_weak(/*integral*/&, /*integral*/,
memory_order, memory_order) volatile noexcept;
bool compare_exchange_weak(/*integral*/&, /*integral*/,
memory_order, memory_order) noexcept;
bool compare_exchange_strong(/*integral*/&, /*integral*/,
memory_order, memory_order) volatile noexcept;
bool compare_exchange_strong(/*integral*/&, /*integral*/,
memory_order, memory_order) noexcept;
bool compare_exchange_weak(/*integral*/&, /*integral*/,
memory_order = memory_order_seq_cst) volatile noexcept;
bool compare_exchange_weak(/*integral*/&, /*integral*/,
memory_order = memory_order_seq_cst) noexcept;
bool compare_exchange_strong(/*integral*/&, /*integral*/,
memory_order = memory_order_seq_cst) volatile noexcept;
bool compare_exchange_strong(/*integral*/&, /*integral*/,
memory_order = memory_order_seq_cst) noexcept;
/*integral*/ fetch_add(/*integral*/,
memory_order = memory_order_seq_cst) volatile noexcept;
/*integral*/ fetch_add(/*integral*/,
memory_order = memory_order_seq_cst) noexcept;
/*integral*/ fetch_sub(/*integral*/,
memory_order = memory_order_seq_cst) volatile noexcept;
/*integral*/ fetch_sub(/*integral*/,
memory_order = memory_order_seq_cst) noexcept;
/*integral*/ fetch_and(/*integral*/,
memory_order = memory_order_seq_cst) volatile noexcept;
/*integral*/ fetch_and(/*integral*/,
memory_order = memory_order_seq_cst) noexcept;
/*integral*/ fetch_or(/*integral*/,
memory_order = memory_order_seq_cst) volatile noexcept;
/*integral*/ fetch_or(/*integral*/,
memory_order = memory_order_seq_cst) noexcept;
/*integral*/ fetch_xor(/*integral*/,
memory_order = memory_order_seq_cst) volatile noexcept;
/*integral*/ fetch_xor(/*integral*/,
memory_order = memory_order_seq_cst) noexcept;
atomic() noexcept = default;
constexpr atomic(/*integral*/) noexcept;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
/*integral*/ operator=(/*integral*/) volatile noexcept;
/*integral*/ operator=(/*integral*/) noexcept;
/*integral*/ operator++(int) volatile noexcept;
/*integral*/ operator++(int) noexcept;
/*integral*/ operator--(int) volatile noexcept;
/*integral*/ operator--(int) noexcept;
/*integral*/ operator++() volatile noexcept;
/*integral*/ operator++() noexcept;
/*integral*/ operator--() volatile noexcept;
/*integral*/ operator--() noexcept;
/*integral*/ operator+=(/*integral*/) volatile noexcept;
/*integral*/ operator+=(/*integral*/) noexcept;
/*integral*/ operator-=(/*integral*/) volatile noexcept;
/*integral*/ operator-=(/*integral*/) noexcept;
/*integral*/ operator&=(/*integral*/) volatile noexcept;
/*integral*/ operator&=(/*integral*/) noexcept;
/*integral*/ operator|=(/*integral*/) volatile noexcept;
/*integral*/ operator|=(/*integral*/) noexcept;
/*integral*/ operator^=(/*integral*/) volatile noexcept;
/*integral*/ operator^=(/*integral*/) noexcept;
};
二次
专业化std::atomic用于指针类型
二次
template <class T> struct atomic<T*> {
bool is_lock_free() const volatile noexcept;
bool is_lock_free() const noexcept;
void store(T*, memory_order = memory_order_seq_cst) volatile noexcept;
void store(T*, memory_order = memory_order_seq_cst) noexcept;
T* load(memory_order = memory_order_seq_cst) const volatile noexcept;
T* load(memory_order = memory_order_seq_cst) const noexcept;
operator T*() const volatile noexcept;
operator T*() const noexcept;
T* exchange(T*, memory_order = memory_order_seq_cst) volatile noexcept;
T* exchange(T*, memory_order = memory_order_seq_cst) noexcept;
bool compare_exchange_weak(T*&, T*, memory_order, memory_order) volatile noexcept;
bool compare_exchange_weak(T*&, T*, memory_order, memory_order) noexcept;
bool compare_exchange_strong(T*&, T*, memory_order, memory_order) volatile noexcept;
bool compare_exchange_strong(T*&, T*, memory_order, memory_order) noexcept;
bool compare_exchange_weak(T*&, T*,
memory_order = memory_order_seq_cst) volatile noexcept;
bool compare_exchange_weak(T*&, T*,
memory_order = memory_order_seq_cst) noexcept;
bool compare_exchange_strong(T*&, T*,
memory_order = memory_order_seq_cst) volatile noexcept;
bool compare_exchange_strong(T*&, T*,
memory_order = memory_order_seq_cst) noexcept;
T* fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile noexcept;
T* fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) noexcept;
T* fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile noexcept;
T* fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) noexcept;
atomic() noexcept = default;
constexpr atomic(T*) noexcept;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;
T* operator=(T*) volatile noexcept;
T* operator=(T*) noexcept;
T* operator++(int) volatile noexcept;
T* operator++(int) noexcept;
T* operator--(int) volatile noexcept;
T* operator--(int) noexcept;
T* operator++() volatile noexcept;
T* operator++() noexcept;
T* operator--() volatile noexcept;
T* operator--() noexcept;
T* operator+=(ptrdiff_t) volatile noexcept;
T* operator+=(ptrdiff_t) noexcept;
T* operator-=(ptrdiff_t) volatile noexcept;
T* operator-=(ptrdiff_t) noexcept;
};
二次
类std::atomic_flag
二次
typedef struct atomic_flag {
bool test_and_set(memory_order = memory_order_seq_cst) volatile noexcept;
bool test_and_set(memory_order = memory_order_seq_cst) noexcept;
void clear(memory_order = memory_order_seq_cst) volatile noexcept;
void clear(memory_order = memory_order_seq_cst) noexcept;
atomic_flag() noexcept = default;
atomic_flag(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) volatile = delete;
} atomic_flag;
二次
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。