名稱空間
變體
操作

標準庫標頭檔案 <stdatomic.h>

來自 cppreference.com
 
 
標準庫標頭檔案
演算法
<algorithm>
<numeric>
字串
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
文字處理
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
數值
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<valarray>
時間
<chrono> (C++11)
<ctime>
C 相容性
<ccomplex> (C++11/17/20*)
<ciso646> (直到 C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

此標頭檔案最初是 C 標準庫的一部分。

此標頭檔案是併發支援庫的一部分。

<stdatomic.h> 是否在名稱空間 std 中提供任何宣告是未指定的。

目錄

(C++23)
相容性宏,使得 _Atomic(T) 等同於 std::atomic<T>
(函式宏) [編輯]
std::atomic_flag 初始化為 false
(宏常量) [編輯]

型別

無鎖布林原子型別
(類) [編輯]
定義給定原子操作的記憶體排序約束
(列舉) [編輯]
std::atomic<bool>
(類型別名) [編輯]
std::atomic<char>
(類型別名) [編輯]
std::atomic<signed char>
(類型別名) [編輯]
std::atomic<unsigned char>
(類型別名) [編輯]
std::atomic<short>
(類型別名) [編輯]
std::atomic<unsigned short>
(類型別名) [編輯]
std::atomic<int>
(類型別名) [編輯]
std::atomic<unsigned int>
(類型別名) [編輯]
std::atomic<long>
(類型別名) [編輯]
std::atomic<unsigned long>
(類型別名) [編輯]
std::atomic<long long>
(類型別名) [編輯]
std::atomic<unsigned long long>
(類型別名) [編輯]
std::atomic<char8_t>
(類型別名) [編輯]
std::atomic<char16_t>
(類型別名) [編輯]
std::atomic<char32_t>
(類型別名) [編輯]
std::atomic<wchar_t>
(類型別名) [編輯]
(C++11)(可選)
std::atomic<std::int8_t>
(類型別名) [編輯]
(C++11)(可選)
std::atomic<std::uint8_t>
(類型別名) [編輯]
(C++11)(可選)
std::atomic<std::int16_t>
(類型別名) [編輯]
(C++11)(可選)
std::atomic<std::uint16_t>
(類型別名) [編輯]
(C++11)(可選)
std::atomic<std::int32_t>
(類型別名) [編輯]
(C++11)(可選)
std::atomic<std::uint32_t>
(類型別名) [編輯]
(C++11)(可選)
std::atomic<std::int64_t>
(類型別名) [編輯]
(C++11)(可選)
std::atomic<std::uint64_t>
(類型別名) [編輯]
std::atomic<std::int_least8_t>
(類型別名) [編輯]
std::atomic<std::uint_least8_t>
(類型別名) [編輯]
std::atomic<std::int_least16_t>
(類型別名) [編輯]
std::atomic<std::uint_least16_t>
(類型別名) [編輯]
std::atomic<std::int_least32_t>
(類型別名) [編輯]
std::atomic<std::uint_least32_t>
(類型別名) [編輯]
std::atomic<std::int_least64_t>
(類型別名) [編輯]
std::atomic<std::uint_least64_t>
(類型別名) [編輯]
std::atomic<std::int_fast8_t>
(類型別名) [編輯]
std::atomic<std::uint_fast8_t>
(類型別名) [編輯]
std::atomic<std::int_fast16_t>
(類型別名) [編輯]
std::atomic<std::uint_fast16_t>
(類型別名) [編輯]
std::atomic<std::int_fast32_t>
(類型別名) [編輯]
std::atomic<std::uint_fast32_t>
(類型別名) [編輯]
std::atomic<std::int_fast64_t>
(類型別名) [編輯]
std::atomic<std::uint_fast64_t>
(類型別名) [編輯]
(C++11)(可選)
std::atomic<std::intptr_t>
(類型別名) [編輯]
(C++11)(可選)
std::atomic<std::uintptr_t>
(類型別名) [編輯]
std::atomic<std::size_t>
(類型別名) [編輯]
std::atomic<std::ptrdiff_t>
(類型別名) [編輯]
std::atomic<std::intmax_t>
(類型別名) [編輯]
std::atomic<std::uintmax_t>
(類型別名) [編輯]

函式

檢查原子型別的操作是否是無鎖的
(函式模板) [編輯]
原子地將原子物件的值替換為非原子引數
(函式模板) [編輯]
原子地獲取原子物件中儲存的值
(函式模板) [編輯]
原子地將原子物件的值替換為非原子引數,並返回原子的舊值
(函式模板) [編輯]
原子地將原子物件的值與非原子引數進行比較,如果相等則執行原子交換,否則執行原子載入
(函式模板) [編輯]
將非原子值新增到原子物件並獲取原子的先前值
(函式模板) [編輯]
從原子物件中減去非原子值並獲取原子的先前值
(函式模板) [編輯]
將原子物件替換為與非原子引數進行位 AND 運算的結果,並獲取原子的先前值
(函式模板) [編輯]
將原子物件替換為與非原子引數進行位 OR 運算的結果,並獲取原子的先前值
(函式模板) [編輯]
將原子物件替換為與非原子引數進行位 XOR 運算的結果,並獲取原子的先前值
(函式模板) [編輯]
原子地將標誌設定為 true 並返回其先前的值
(函式) [編輯]
原子地將標誌的值設定為 false
(函式) [編輯]
通用記憶體排序依賴的屏障同步原語
(函式) [編輯]
執行緒與在同一執行緒中執行的訊號處理程式之間的屏障
(函式) [編輯]

[編輯] 摘要

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