Skip to content

AConditionVariable#

Represents a condition variable.

Header:#include <AUI/Thread/AConditionVariable.h>
CMake:aui_link(my_target PUBLIC aui::core)

Detailed Description#

AConditionVariable extends std::condition_variable with thread interruption functionality.

Public Methods#

notify_all#


void AConditionVariable::notify_all()

Notifies all observing threads.

Performance note
This function is faster than notify_one.

notify_one#


void AConditionVariable::notify_one()

Notifies one observing thread.

Performance note
This function is slower than notify_all.

wait#


template<typename Lock, typename Predicate >
void AConditionVariable::wait(Lock& lock, Predicate&& predicate)
Arguments
lock
lock.
predicate
which returns false if the waiting should be continued.

Waits for the notification.

wait_for#


template<typename Lock, typename Duration >
void AConditionVariable::wait_for(Lock& lock, Duration duration)
Arguments
lock
lock.
duration
duration to waitForExitCode for.

Waits for the notification.


template<typename Lock, typename Duration, typename Predicate >
void AConditionVariable::wait_for(Lock& lock, Duration duration, Predicate&& predicate)
Arguments
lock
lock.
duration
duration to waitForExitCode for.
predicate
which returns false if the waiting should be continued.

Waits for the notification.

wait_until#


template<typename Lock, typename Timepoint >
void AConditionVariable::wait_until(Lock& lock, Timepoint timepoint)
Arguments
lock
lock.
timepoint
timepoint to waitForExitCode until.

Waits until the notification.


template<typename Lock, typename Duration, typename Predicate >
void AConditionVariable::wait_until(Lock& lock, Duration duration, Predicate&& predicate)
Arguments
lock
lock.
duration
duration to waitForExitCode until.
predicate
which returns false if the waiting should be continued.

Waits until the notification.