AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
AConditionVariable Class Reference

Represents a condition variable. More...

Detailed Description

Represents a condition variable.

AConditionVariable extends std::condition_variable with thread interruption functionality.

Public Member Functions

void notify_all () noexcept
 
void notify_one () noexcept
 
template<typename Lock >
void wait (Lock &lock)
 
template<typename Lock , typename Predicate >
void wait (Lock &lock, Predicate &&predicate)
 
template<typename Lock , typename Duration >
void wait_for (Lock &lock, Duration duration)
 
template<typename Lock , typename Duration , typename Predicate >
void wait_for (Lock &lock, Duration duration, Predicate &&predicate)
 
template<typename Lock , typename Timepoint >
void wait_until (Lock &lock, Timepoint timepoint)
 
template<typename Lock , typename Duration , typename Predicate >
void wait_until (Lock &lock, Duration duration, Predicate &&predicate)
 

Member Function Documentation

◆ notify_all()

void AConditionVariable::notify_all ( )
inlinenoexcept

Notifies all observing threads.

Performance note
This function is faster than notify_one.

◆ notify_one()

void AConditionVariable::notify_one ( )
inlinenoexcept

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 
)
inline

Waits for the notification.

Parameters
locklock.
predicatewhich returns false if the waiting should be continued.

◆ wait_for() [1/2]

template<typename Lock , typename Duration >
void AConditionVariable::wait_for ( Lock &  lock,
Duration  duration 
)
inline

Waits for the notification.

Parameters
locklock.
durationduration to waitForExitCode for.

◆ wait_for() [2/2]

template<typename Lock , typename Duration , typename Predicate >
void AConditionVariable::wait_for ( Lock &  lock,
Duration  duration,
Predicate &&  predicate 
)
inline

Waits for the notification.

Parameters
locklock.
durationduration to waitForExitCode for.
predicatewhich returns false if the waiting should be continued.

◆ wait_until() [1/2]

template<typename Lock , typename Duration , typename Predicate >
void AConditionVariable::wait_until ( Lock &  lock,
Duration  duration,
Predicate &&  predicate 
)
inline

Waits until the notification.

Parameters
locklock.
durationduration to waitForExitCode until.
predicatewhich returns false if the waiting should be continued.

◆ wait_until() [2/2]

template<typename Lock , typename Timepoint >
void AConditionVariable::wait_until ( Lock &  lock,
Timepoint  timepoint 
)
inline

Waits until the notification.

Parameters
locklock.
durationduration to waitForExitCode until.

#include <AUI/Thread/AConditionVariable.h>


The documentation for this class was generated from the following file: