tmc::atomic_condvar#

A wrapper around std::atomic<T> which exposes async variants of wait() and notify_*().

API Reference#

template<typename T>
class atomic_condvar#

Wraps an atomic integral type. Exposes async analogues to std::atomic<T>::wait() and std::atomic<T>::notify_*().

Public Functions

inline atomic_condvar(T InitialValue) noexcept#

Sets the initial value of the contained atomic variable.

inline std::atomic<T> &ref() noexcept#

Returns a reference to the contained atomic variable.

inline const std::atomic<T> &ref() const noexcept#

Returns a reference to the contained atomic variable.

inline aw_atomic_condvar_co_notify<T> co_notify_one(size_t NotifyCount = 1) noexcept#

Wakes 1 awaiter that meet the criteria (expected != current value). The awaiter may be resumed by symmetric transfer if it is eligible (it resumes on the same executor and priority as the caller). Awaiters are woken in LIFO order.

inline aw_atomic_condvar_co_notify<T> co_notify_n(size_t NotifyCount = 1) noexcept#

Wakes up to NotifyCount awaiters that meet the criteria (expected != current value). Up to one awaiter may be resumed by symmetric transfer if it is eligible (it resumes on the same executor and priority as the caller). Awaiters are woken in LIFO order.

inline aw_atomic_condvar_co_notify<T> co_notify_all() noexcept#

Wakes all awaiters that meet the criteria (expected != current value). Up to one awaiter may be resumed by symmetric transfer if it is eligible (it resumes on the same executor and priority as the caller).

inline void notify_one()#

Wakes 1 awaiter that meet the criteria (expected != current value). Does not symmetric transfer; the awaiter will be posted to its executor. Awaiters are woken in LIFO order.

inline void notify_n(size_t NotifyCount = 1)#

Wakes up to NotifyCount awaiters that meet the criteria (expected != current value). Does not symmetric transfer; awaiters will be posted to their executors. Awaiters are woken in LIFO order.

inline void notify_all()#

Wakes all awaiters that meet the criteria (expected != current value). Does not symmetric transfer; awaiters will be posted to their executors.

inline aw_atomic_condvar<T> await(T Expected) noexcept#

Suspends until Expected != current value. If this condition is already true, resumes immediately.

inline ~atomic_condvar()#

On destruction, any awaiters will be resumed.