std::atomic_flag_clear, std::atomic_flag_clear_explicit
来自cppreference.com
| 定义于头文件 <atomic>
|
||
| (1) | (C++11 起) | |
| void atomic_flag_clear( volatile std::atomic_flag* p ) noexcept; |
||
| void atomic_flag_clear( std::atomic_flag* p ) noexcept; |
||
| (2) | (C++11 起) | |
| void atomic_flag_clear_explicit( volatile std::atomic_flag* p, std::memory_order order ) noexcept; |
||
| void atomic_flag_clear_explicit( std::atomic_flag* p, std::memory_order order ) noexcept; |
||
原子地更改 p 所指向的 std::atomic_flag 为清除( false )。
参数
| p | - | 指向要访问的 std::atomic_flag 的指针 |
| order | - | 此操作所用的内存同步顺序,只容许 std::memory_order_relaxed 、 std::memory_order_release 或 std::memory_order_seq_cst 。 |
返回值
无。
可能的实现
| 版本一 |
|---|
void atomic_flag_clear(volatile std::atomic_flag* p) { p->clear(); } |
| 版本二 |
void atomic_flag_clear(std::atomic_flag* p) { p->clear(); } |
| 版本三 |
void atomic_flag_clear_explicit(volatile std::atomic_flag* p, std::memory_order order) { p->clear(order); } |
| 版本四 |
void atomic_flag_clear_explicit(std::atomic_flag* p, std::memory_order order) { p->clear(order); } |
参阅
| (C++11) |
免锁的布尔原子类型 (类) |
| 原子地设置标志为 true 并返回其先前值 (函数) | |
| (C++11) |
为给定的原子操作定义内存顺序制约 (枚举) |