原子操作库
来自cppreference.com
                    
                                        
                    < c
                    
                                                            
                    若编译器定义宏常量 __STDC_NO_ATOMICS__(C11) ,则不提供头文件 <stdatomic.h> 、关键词 _Atomic 以及所有列于此的名称。
类型
|   在标头  
<stdatomic.h> 定义  | |
|    (C11)  | 
   定义内存顺序制约   (枚举)  | 
|    (C11)  | 
  免锁布尔标志  (结构体)  | 
宏
|   在标头  
<stdatomic.h> 定义  | |
|    指示给定的原子类型为免锁   (宏常量)  | |
|    (C11)  | 
   初始化新的 atomic_flag   (宏常量)  | 
|    (C11)(C17 中弃用)(C23 中移除)  | 
   初始化新的原子对象   (宏函数)  | 
|    (C11)  | 
   打破 memory_order_consume 的依赖链   (宏函数)  | 
函数
|   在标头  
<stdatomic.h> 定义  | |
   设置 atomic_flag 为 true 并返回旧值  (函数)  | |
   设置 atomic_flag 为 false  (函数)  | |
|    (C11)  | 
   初始化既存的原子对象   (函数)  | 
|    (C11)  | 
   指示原子对象是否免锁   (函数)  | 
|    存储值到原子对象   (函数)  | |
|    从原子对象读取值   (函数)  | |
|    与原子对象的值交换值   (函数)  | |
|    若期待旧值则与原子对象交换值,否则读取旧值   (函数)  | |
|    原子加法   (函数)  | |
|    原子减法   (函数)  | |
|   原子逐位或  (函数)  | |
|   原子逐位异或  (函数)  | |
|   原子逐位与  (函数)  | |
|    (C11)  | 
   通用的内存顺序依赖的栅栏同步原语   (函数)  | 
|    (C11)  | 
   线程与执行于同一线程的信号处理函数间的栅栏   (函数)  | 
类型
标准库为核心语言原子类型提供便利 typedef 。
| typedef 名 | 完整类型名 | 
  atomic_bool
 | 
_Atomic _Bool | 
  atomic_char
 | 
_Atomic char | 
  atomic_schar
 | 
_Atomic signed char | 
  atomic_uchar
 | 
_Atomic unsigned char | 
  atomic_short
 | 
_Atomic short | 
  atomic_ushort
 | 
_Atomic unsigned short | 
  atomic_int
 | 
_Atomic int | 
  atomic_uint
 | 
_Atomic unsigned int | 
  atomic_long
 | 
_Atomic long | 
  atomic_ulong
 | 
_Atomic unsigned long | 
  atomic_llong
 | 
_Atomic long long | 
  atomic_ullong
 | 
_Atomic unsigned long long | 
  atomic_char16_t
 | 
_Atomic char16_t | 
  atomic_char32_t
 | 
_Atomic char32_t | 
  atomic_wchar_t
 | 
_Atomic wchar_t | 
  atomic_int_least8_t
 | 
_Atomic int_least8_t | 
  atomic_uint_least8_t
 | 
_Atomic uint_least8_t | 
  atomic_int_least16_t
 | 
_Atomic int_least16_t | 
  atomic_uint_least16_t
 | 
_Atomic uint_least16_t | 
  atomic_int_least32_t
 | 
_Atomic int_least32_t | 
  atomic_uint_least32_t
 | 
_Atomic uint_least32_t | 
  atomic_int_least64_t
 | 
_Atomic int_least64_t | 
  atomic_uint_least64_t
 | 
_Atomic uint_least64_t | 
  atomic_int_fast8_t
 | 
_Atomic int_fast8_t | 
  atomic_uint_fast8_t
 | 
_Atomic uint_fast8_t | 
  atomic_int_fast16_t
 | 
_Atomic int_fast16_t | 
  atomic_uint_fast16_t
 | 
_Atomic uint_fast16_t | 
  atomic_int_fast32_t
 | 
_Atomic int_fast32_t | 
  atomic_uint_fast32_t
 | 
_Atomic uint_fast32_t | 
  atomic_int_fast64_t
 | 
_Atomic int_fast64_t | 
  atomic_uint_fast64_t
 | 
_Atomic uint_fast64_t | 
  atomic_intptr_t
 | 
_Atomic intptr_t | 
  atomic_uintptr_t
 | 
_Atomic uintptr_t | 
  atomic_size_t
 | 
_Atomic size_t | 
  atomic_ptrdiff_t
 | 
_Atomic ptrdiff_t | 
  atomic_intmax_t
 | 
_Atomic intmax_t | 
  atomic_uintmax_t
 | 
_Atomic uintmax_t | 
引用
- C11 标准(ISO/IEC 9899:2011):
 
- 7.17 Atomics <stdatomic.h> (第 273-286 页)
 
- 7.31.8 Atomics <stdatomic.h> (第 455-456 页)