标准库标头 <stdatomic.h> (C++23) - cppreference.com

标准库标头 <stdatomic.h> (C++23)

来自cppreference.com


 
 
标准库头
通用工具
<any> (C++17)
<bitset>
<bit> (C++20)
<charconv> (C++17)
<expected> (C++23)
<format> (C++20)
<functional>
<optional> (C++17)
<stdbit.h> (C++26)
<tuple> (C++11)
<typeindex> (C++11)
<utility>
<variant> (C++17)
容器
<array> (C++11)
<deque>
<flat_map> (C++23)
<flat_set> (C++23)
<forward_list> (C++11)
<hive> (C++26)
<inplace_vector> (C++26)   
<list>
<map>
<mdspan> (C++23)
<queue>
<set>
<span> (C++20)
<stack>
<unordered_map> (C++11)
<unordered_set> (C++11)
<vector>
迭代器
<iterator>
范围
<generator> (C++23)
<ranges> (C++20)
 

此标头原本在 C 标准库中(<stdatomic.h>)。

此标头是并发支持库的一部分。

未指定 <stdatomic.h> 是否提供任何命名空间 std 中的声明。

概要

template<class T>
  using __std_atomic = std::atomic<T>;        // 仅用于阐释

#define _Atomic(T) __std_atomic<T>

#define ATOMIC_BOOL_LOCK_FREE /* 见描述 */
#define ATOMIC_CHAR_LOCK_FREE /* 见描述 */
#define ATOMIC_CHAR16_T_LOCK_FREE /* 见描述 */
#define ATOMIC_CHAR32_T_LOCK_FREE /* 见描述 */
#define ATOMIC_WCHAR_T_LOCK_FREE /* 见描述 */
#define ATOMIC_SHORT_LOCK_FREE /* 见描述 */
#define ATOMIC_INT_LOCK_FREE /* 见描述 */
#define ATOMIC_LONG_LOCK_FREE /* 见描述 */
#define ATOMIC_LLONG_LOCK_FREE /* 见描述 */
#define ATOMIC_POINTER_LOCK_FREE /* 见描述 */

using std::memory_order;                // 见描述
using std::memory_order_relaxed;        // 见描述
using std::memory_order_consume;        // 见描述
using std::memory_order_acquire;        // 见描述
using std::memory_order_release;        // 见描述
using std::memory_order_acq_rel;        // 见描述
using std::memory_order_seq_cst;        // 见描述

using std::atomic_flag;                 // 见描述

using std::atomic_bool;                 // 见描述
using std::atomic_char;                 // 见描述
using std::atomic_schar;                // 见描述
using std::atomic_uchar;                // 见描述
using std::atomic_short;                // 见描述
using std::atomic_ushort;               // 见描述
using std::atomic_int;                  // 见描述
using std::atomic_uint;                 // 见描述
using std::atomic_long;                 // 见描述
using std::atomic_ulong;                // 见描述
using std::atomic_llong;                // 见描述
using std::atomic_ullong;               // 见描述
using std::atomic_char8_t;              // 见描述
using std::atomic_char16_t;             // 见描述
using std::atomic_char32_t;             // 见描述
using std::atomic_wchar_t;              // 见描述
using std::atomic_int8_t;               // 见描述
using std::atomic_uint8_t;              // 见描述
using std::atomic_int16_t;              // 见描述
using std::atomic_uint16_t;             // 见描述
using std::atomic_int32_t;              // 见描述
using std::atomic_uint32_t;             // 见描述
using std::atomic_int64_t;              // 见描述
using std::atomic_uint64_t;             // 见描述
using std::atomic_int_least8_t;         // 见描述
using std::atomic_uint_least8_t;        // 见描述
using std::atomic_int_least16_t;        // 见描述
using std::atomic_uint_least16_t;       // 见描述
using std::atomic_int_least32_t;        // 见描述
using std::atomic_uint_least32_t;       // 见描述
using std::atomic_int_least64_t;        // 见描述
using std::atomic_uint_least64_t;       // 见描述
using std::atomic_int_fast8_t;          // 见描述
using std::atomic_uint_fast8_t;         // 见描述
using std::atomic_int_fast16_t;         // 见描述
using std::atomic_uint_fast16_t;        // 见描述
using std::atomic_int_fast32_t;         // 见描述
using std::atomic_uint_fast32_t;        // 见描述
using std::atomic_int_fast64_t;         // 见描述
using std::atomic_uint_fast64_t;        // 见描述
using std::atomic_intptr_t;             // 见描述
using std::atomic_uintptr_t;            // 见描述
using std::atomic_size_t;               // 见描述
using std::atomic_ptrdiff_t;            // 见描述
using std::atomic_intmax_t;             // 见描述
using std::atomic_uintmax_t;            // 见描述

using std::atomic_is_lock_free;                         // 见描述
using std::atomic_load;                                 // 见描述
using std::atomic_load_explicit;                        // 见描述
using std::atomic_store;                                // 见描述
using std::atomic_store_explicit;                       // 见描述
using std::atomic_exchange;                             // 见描述
using std::atomic_exchange_explicit;                    // 见描述
using std::atomic_compare_exchange_strong;              // 见描述
using std::atomic_compare_exchange_strong_explicit;     // 见描述
using std::atomic_compare_exchange_weak;                // 见描述
using std::atomic_compare_exchange_weak_explicit;       // 见描述
using std::atomic_fetch_add;                            // 见描述
using std::atomic_fetch_add_explicit;                   // 见描述
using std::atomic_fetch_sub;                            // 见描述
using std::atomic_fetch_sub_explicit;                   // 见描述
using std::atomic_fetch_or;                             // 见描述
using std::atomic_fetch_or_explicit;                    // 见描述
using std::atomic_fetch_xor;                            // 见描述
using std::atomic_fetch_xor_explicit;                   // 见描述
using std::atomic_fetch_and;                            // 见描述
using std::atomic_fetch_and_explicit;                   // 见描述
using std::atomic_flag_test_and_set;                    // 见描述
using std::atomic_flag_test_and_set_explicit;           // 见描述
using std::atomic_flag_clear;                           // 见描述
using std::atomic_flag_clear_explicit;                  // 见描述

#define ATOMIC_FLAG_INIT /* 见描述 */

using std::atomic_thread_fence;                         // 见描述
using std::atomic_signal_fence;                         // 见描述