ML Reference
ml::WaitCondition Class Reference

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

#include <mlWaitCondition.h>

List of all members.

Public Member Functions

 WaitCondition ()
void wait (Lock &lock)
 Waits for the condition, given a locked non-recursive mutex.
void notifyAll ()
 Notifies all waiting threads.
void notifyOne ()
 Notifies one waiting thread.

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

Definition at line 42 of file mlWaitCondition.h.


Constructor & Destructor Documentation

ml::WaitCondition::WaitCondition ( ) [inline]

Definition at line 45 of file mlWaitCondition.h.


Member Function Documentation

void ml::WaitCondition::notifyAll ( ) [inline]

Notifies all waiting threads.

Definition at line 59 of file mlWaitCondition.h.

void ml::WaitCondition::notifyOne ( ) [inline]

Notifies one waiting thread.

Definition at line 67 of file mlWaitCondition.h.

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 51 of file mlWaitCondition.h.


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