MeVisLab Toolbox Reference
ml::WaitCondition Class Reference

WaitCondition implements a wait condition for thread synchronization. More...

#include <mlWaitCondition.h>

Public Member Functions

 WaitCondition ()
 
void wait (Lock &lock)
 Waits for the condition, given a locked non-recursive mutex. More...
 
template<typename duration_type >
bool wait (Lock &lock, duration_type duration)
 Waits for the condition, given a locked non-recursive mutex. More...
 
void notifyAll ()
 Notifies all waiting threads. More...
 
void notifyOne ()
 Notifies one waiting thread. More...
 

Detailed Description

WaitCondition implements a wait condition for thread synchronization.

Thread-safety: This class is thread-safe.

Please note that wait conditions can return from a wait call "spuriously", even when not notified. So the typical use case when waiting for a condition should be:

Lock lock(_someMutex);
while (!someConditionIsTrue) {
_condition.wait(lock)
}
boost::mutex::scoped_lock Lock
Defines a lock for locking a non-recursive mutex.
Definition: mlMutex.h:41

Definition at line 45 of file mlWaitCondition.h.

Constructor & Destructor Documentation

◆ WaitCondition()

ml::WaitCondition::WaitCondition ( )
inline

Definition at line 48 of file mlWaitCondition.h.

Member Function Documentation

◆ notifyAll()

void ml::WaitCondition::notifyAll ( )
inline

Notifies all waiting threads.

Definition at line 71 of file mlWaitCondition.h.

◆ notifyOne()

void ml::WaitCondition::notifyOne ( )
inline

Notifies one waiting thread.

Definition at line 79 of file mlWaitCondition.h.

◆ wait() [1/2]

void ml::WaitCondition::wait ( Lock lock)
inline

Waits for the condition, given a locked non-recursive mutex.

The mutex will be released and locked again when wait() returns.

Definition at line 54 of file mlWaitCondition.h.

◆ wait() [2/2]

template<typename duration_type >
bool ml::WaitCondition::wait ( Lock lock,
duration_type  duration 
)
inline

Waits for the condition, given a locked non-recursive mutex.

The mutex will be released and locked again when wait() returns.

Definition at line 63 of file mlWaitCondition.h.


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