9#if defined(COOPSYNC_TBB_DOXYGEN) || (defined(COOPSYNC_TBB_HAS_ATOMIC_FLAG) && \
10 COOPSYNC_TBB_HAS_ATOMIC_FLAG == 1)
14#include "coopsync_tbb/detail/macros.hpp"
15#include "coopsync_tbb/detail/wait_queue.hpp"
54 void clear(std::memory_order order = std::memory_order_seq_cst)
noexcept;
59 std::memory_order order = std::memory_order_seq_cst)
noexcept;
65 std::memory_order order = std::memory_order_seq_cst)
const noexcept;
79 void wait(
bool old, std::memory_order order = std::memory_order_seq_cst);
120 detail::wait_queue m_waiters;
135 atomic_flag*
object, std::memory_order order)
noexcept;
147 atomic_flag*
object, std::memory_order order)
noexcept;
160 atomic_flag*
object, std::memory_order order)
noexcept;
188 std::memory_order order);
204#error "Atomic flag condition variable is not supported on this platform."
Wrapper around std::atomic_flag that provides atomic waiting which suspends the calling task instead ...
Definition atomic_flag.hpp:26
void notify_one()
Resumes one task suspended waiting on this atomic_flag, if there is any.
void wait(bool old, std::memory_order order=std::memory_order_seq_cst)
Suspends the calling task until the state is not equal to specified value. If the state is not equal ...
void notify_all()
Resumes all tasks suspended waiting on this atomic_flag.
atomic_flag()=default
Constructs a new atomic_flag. Initializes to clear state.
atomic_flag(atomic_flag &&)=delete
The atomic_flag is not move-constructible.
void clear(std::memory_order order=std::memory_order_seq_cst) noexcept
Atomically sets the state to clear.
bool test(std::memory_order order=std::memory_order_seq_cst) const noexcept
Atomically reads the current state and returns it.
atomic_flag(const atomic_flag &)=delete
The atomic_flag is not copy-constructible.
bool test_and_set(std::memory_order order=std::memory_order_seq_cst) noexcept
Atomically sets the state to set and returns the previous state.
~atomic_flag()
Destroys the atomic_flag.
atomic_flag & operator=(atomic_flag &&)=delete
The atomic_flag is not move-assignable.
std::atomic_flag & atomic() noexcept
Access to the internal atomic value.
atomic_flag & operator=(const atomic_flag &)=delete
The atomic_flag is not copy-assignable.
Feature test macros for the CoopSync_TBB public API.
Main namespace of the library, containing all public APIs.
Definition wait_for.hpp:11
COOPSYNC_TBB_EXPORT void atomic_flag_notify_one(atomic_flag *object)
Resumes one task suspended waiting on the atomic_flag, if there is any. Same as object....
COOPSYNC_TBB_EXPORT void atomic_flag_notify_all(atomic_flag *object)
Resumes all tasks suspended waiting on the atomic_flag. Same as object.notify_all().
COOPSYNC_TBB_EXPORT void atomic_flag_clear_explicit(atomic_flag *object, std::memory_order order) noexcept
Atomically sets the state to clear. Same as object->clear(order).
COOPSYNC_TBB_EXPORT void atomic_flag_clear(atomic_flag *object) noexcept
Atomically sets the state to clear. Same as object->clear().
COOPSYNC_TBB_EXPORT void atomic_flag_wait_explicit(atomic_flag *object, bool old, std::memory_order order)
Suspends the calling task until the state is not equal to specified value. If the internal atomic the...
COOPSYNC_TBB_EXPORT bool atomic_flag_test_and_set(atomic_flag *object) noexcept
Atomically sets the state to set and returns the previous state. Same as object->test_and_set().
COOPSYNC_TBB_EXPORT bool atomic_flag_test_and_set_explicit(atomic_flag *object, std::memory_order order) noexcept
Atomically sets the state to set and returns the previous state. Same as object->test_and_set(order).
COOPSYNC_TBB_EXPORT void atomic_flag_wait(atomic_flag *object, bool old)
Suspends the calling task until the state is not equal to specified value. If the internal atomic the...
COOPSYNC_TBB_EXPORT bool atomic_flag_test(atomic_flag *object) noexcept
Atomically reads the current state and returns it. Same as object->test().
COOPSYNC_TBB_EXPORT bool atomic_flag_test_explicit(atomic_flag *object, std::memory_order order) noexcept
Atomically reads the current state and returns it. Same as object->test(order).