From cppreference.com
Defined in header
boolatomic_flag_test(constvolatilestd::atomic_flag*object)noexcept; (1) (since C++20)boolatomic_flag_test(conststd::atomic_flag*object)noexcept; (2) (since C++20)boolatomic_flag_test_explicit(constvolatilestd::atomic_flag*object,std::memory_orderorder)noexcept; (3) (since C++20)boolatomic_flag_test_explicit(conststd::atomic_flag*object,std::memory_orderorder)noexcept; (4) (since C++20)Atomically reads the value of the *object and returns the value.
1,2) The memory synchronization order is std::memory_order_seq_cst.
3,4) The memory synchronization order is order.
If order is one of std::memory_order::release and std::memory_order::acq_rel, the behavior is undefined.
Parameters
object - pointer to the atomic_flag object to read order - the memory synchronization ordering Return value
The value atomically read.
Notes
macroValueStdFeature
(C++20)std::atomic_flag::testExample
See also
(C++20)
atomically returns the value of the flag
(public member function of std::atomic_flag)