std::atomic_flag_test, std::atomic_flag_test_explicit
来自 cppreference.cn
定义于头文件 <atomic> |
||
bool atomic_flag_test( const volatile std::atomic_flag* object ) noexcept; |
(1) | (C++20 起) |
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; |
(3) | (C++20 起) |
bool atomic_flag_test_explicit( const std::atomic_flag* object, std::memory_order order ) noexcept; |
(4) | (C++20 起) |
原子地读取 *object 的值并返回该值。
1,2) 内存同步顺序为 std::memory_order_seq_cst。
3,4) 内存同步顺序为 order。
如果 order 为 std::memory_order::release 和 std::memory_order::acq_rel 之一,则行为未定义。
目录 |
[编辑] 参数
对象 | - | 指向要读取的 atomic_flag 对象的指针 |
顺序 | - | 内存同步顺序 |
[编辑] 返回值
原子读取的值。
[编辑] 注意
特性测试宏 | 值 | 标准 | 特性 |
---|---|---|---|
__cpp_lib_atomic_flag_test |
201907L |
(C++20) | std::atomic_flag::test
|
[编辑] 示例
本节不完整 原因:无示例 |
[编辑] 参阅
(C++20) |
原子地返回标志的值 ( std::atomic_flag 的公共成员函数) |