std::atomic_flag_test, std::atomic_flag_test_explicit
来自cppreference.com
| 定义于头文件 <atomic>
|
||
| (1) | (C++20 起) | |
| bool atomic_flag_test( const volatile std::atomic_flag* object ) noexcept; |
||
| bool atomic_flag_test( const std::atomic_flag* object ) noexcept; |
||
| (2) | (C++20 起) | |
| bool atomic_flag_test_explicit( const volatile std::atomic_flag* object, std::memory_order order ) noexcept; |
||
| bool atomic_flag_test_explicit( const std::atomic_flag* object, std::memory_order order ) noexcept; |
||
原子地读取 *object 的值并返回该值。
1) 等价于 object->test(std::memory_order_seq_cst) 。
2) 等价于 object->test(order) 。
参数
| object | - | 指向要读取的 atomic_flag 对象的指针
|
| order | - | 此操作使用的内存同步顺序:必须不为 std::memory_order::release 或 std::memory_order::acq_rel |
返回值
原子地读取的值。
示例
| 本节未完成 原因:暂无示例 |
参阅
| (C++20) |
原子地返回标志的值 ( std::atomic_flag 的公开成员函数) |