bool atomic_flag_test_and_set (volatile atomic_flag* obj, memory_order sync) noexcept;
bool atomic_flag_test_and_set (atomic_flag* obj, memory_order sync) noexcept;
Test and set atomic flag (explicit memory order)
Sets the atomic flag pointed by obj and returns the value it had immediately before the call.
The entire operation is atomic (an atomic read-modify-write operation): the value of obj is not affected by other threads between the instant its value is read (to be returned) and the moment it is modified by this function.
See atomic_flag::test_and_set for the equivalent member function of atomic_flag.
- Pointer to the atomic_flag object to set.
- Synchronization mode for the operation.
This shall be a values of the
enum type memory_order.
true if obj was already set before the call.
No data races (atomic operation). Memory order specified by argument sync.
No-throw guarantee: never throws exceptions.