atomic_flag_test_and_set, atomic_flag_test_and_set_explicit
来自cppreference.com
|
|
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
| 在头文件 <stdatomic.h> 中定义
|
||
| _Bool atomic_flag_test_and_set( volatile atomic_flag* obj ); |
(1) | |
| _Bool atomic_flag_test_and_set_explicit( volatile atomic_flag* obj, memory_order order ); |
(2) | |
原子的状态更改的
atomic_flag指出,obj进行设置(true),并返回以前的值。根据memory_order_seq_cst的第一个版本订单的内存访问,第二个版本的订单内存访问,根据order.原文:
Atomically changes the state of a
atomic_flag pointed to by obj to set (true) and returns the previous value. The first version orders memory accesses according to memory_order_seq_cst, the second version orders memory accesses according to order.[编辑] 参数
| obj | - | 指针的原子标志要修改的对象
原文: pointer to the atomic flag object to modify |
| order | - | 内存同步进行此操作的顺序:所有的允许值
原文: the memory synchronization ordering for this operation: all values are permitted |
[编辑] 返回值
以前的值由原子标志所指向的
obj.原文:
The previous value held by the atomic flag pointed to by
obj.[编辑] 另请参阅
| 设置为false atomic_flag (函数) | |
| C++ documentation for atomic_flag_test_and_set, atomic_flag_test_and_set_explicit
| |