atomic_flag_test_and_set, atomic_flag_test_and_set_explicit
来自 cppreference.cn
定义于头文件 <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 原子标志的指针,以接受非 volatile 和 volatile (例如,内存映射 I/O) 原子标志的地址。
目录 |
[编辑] 参数
obj | - | 指向要修改的原子标志对象的指针 |
order | - | 此操作的内存同步顺序:允许所有值 |
[编辑] 返回值
obj
指向的原子标志对象先前持有的值。
[编辑] 参考文献
- C17 标准 (ISO/IEC 9899:2018)
- 7.17.8.1 atomic_flag_test_and_set 函数 (p: 209)
- C11 标准 (ISO/IEC 9899:2011)
- 7.17.8.1 atomic_flag_test_and_set 函数 (p: 285-286)
[编辑] 参见
将原子标志设置为 false (函数) | |
C++ 文档 关于 atomic_flag_test_and_set, atomic_flag_test_and_set_explicit
|