CoreComponents 3.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches
WaitCondition Class Reference

Conditional thread suspension and resumption. More...

#include <cc/WaitCondition>

Public Member Functions

 WaitCondition ()
 Create a new wait condition.
 
void wait (Mutex &mutex)
 Wait for a certain condition.
 
bool waitUntil (double time, Mutex &mutex)
 Wait for a certain condition for a limited time.
 
void signal ()
 Wake up one waiting thread.
 
void broadcast ()
 Wake up all waiting threads.
 

Detailed Description

Conditional thread suspension and resumption.

Exceptions
SystemError

Constructor & Destructor Documentation

◆ WaitCondition()

Create a new wait condition.

Member Function Documentation

◆ wait()

void wait ( Mutex & mutex)

Wait for a certain condition.

Parameters
mutexMutex protecting the condition state

◆ waitUntil()

bool waitUntil ( double time,
Mutex & mutex )

Wait for a certain condition for a limited time.

Parameters
timeSeconds elapsed since the begin of Epoch
mutexMutex protecting the condition state
See also
System::now()

◆ signal()

void signal ( )

Wake up one waiting thread.

Todo
rename to "notifyOne"

◆ broadcast()

void broadcast ( )

Wake up all waiting threads.

Todo
rename to "notifyAll"