|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Defined in header <atomic> | ||
void atomic_flag_clear(volatilestd::atomic_flag* obj)noexcept; | (1) | (since C++11) |
void atomic_flag_clear(std::atomic_flag* obj)noexcept; | (2) | (since C++11) |
void atomic_flag_clear_explicit(volatilestd::atomic_flag* obj, std::memory_order order)noexcept; | (3) | (since C++11) |
void atomic_flag_clear_explicit(std::atomic_flag* obj, std::memory_order order)noexcept; | (4) | (since C++11) |
Atomically changes the state of thestd::atomic_flag pointed to byobj to clear (false).
Contents |
| obj | - | pointer tostd::atomic_flag to access |
| order | - | the memory synchronization ordering |
std::atomic_flag_clear andstd::atomic_flag_clear_explicit can be implemented asobj->clear() andobj->clear(order) respectively.
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 2138 | C++11 | order could bestd::memory_order_consume | the behavior is undefined in this case |
(C++11) | the lock-free boolean atomic type (class)[edit] |
| atomically sets the flag totrue and returns its previous value (function)[edit] | |
(C++11) | defines memory ordering constraints for the given atomic operation (enum)[edit] |
C documentation foratomic_flag_clear,atomic_flag_clear_explicit | |