std::atomic_flag_wait, std::atomic_flag_wait_explicit
Min standard notice:
Header: <atomic>
Performs atomic waiting operations.
# Declarations
void atomic_flag_wait( const atomic_flag* object, bool old ) noexcept;
(since C++20)
void atomic_flag_wait( const volatile atomic_flag* object,
bool old ) noexcept;
(since C++20)
void atomic_flag_wait_explicit( const atomic_flag* object,
bool old, std::memory_order order ) noexcept;
(since C++20)
void atomic_flag_wait_explicit( const volatile atomic_flag* object,
bool old, std::memory_order order ) noexcept;
(since C++20)
# Parameters
object: pointer to the atomic flag to check and wait onold: the value to check the atomic flag no longer containsorder: the memory synchronization ordering
# Return value
(none)
# Notes
This form of change-detection is often more efficient than simple polling or pure spinlocks.
Due to the ABA problem, transient changes from old to another value and back to old might be missed, and not unblock.
# Example
This section is incompleteReason: no example