atomic_flag_test_and_set, atomic_flag_test_and_set_explicit
来自cppreference.com
                    
                                        
                    
                    
                                                            
                    |   定义于头文件  <stdatomic.h>
  | 
||
|   _Bool atomic_flag_test_and_set( volatile atomic_flag* obj );  | 
(1) | (C11 起) | 
|   _Bool atomic_flag_test_and_set_explicit( volatile atomic_flag* obj, memory_order order );  | 
(2) | (C11 起) | 
原子地更改 obj 所指向的 atomic_flag 的状态为设置( true ),并返回先前值。第一版本按 memory_order_seq_cst 排序内存访问,第二版本按 order 排序内存访问。
参数是为指向 volatile atomic_flag 的指针,以接受非 volatile 和 volatile (例如映射到内存的 I/O )的 atomic_flag 。
参数
| obj | - |   指向要修改的 atomic_flag 对象的指针
 | 
| order | - | 此操作所用的内存同步顺序:容许所有值 | 
返回值
obj 所指向的 atomic_flag 的先前值。
引用
- C11 standard (ISO/IEC 9899:2011):
 
- 7.17.8.1 The atomic_flag_test_and_set functions (p: 285-286)
 
参阅
   设置 atomic_flag 为 false  (函数)  |