Condition variable synchronization primitive. Can be used to wait for a condition to become true in a safe way.
More...
#include <mitsuba/core/lock.h>
|
| ConditionVariable (Mutex *mutex=NULL) |
| Create a new condition variable. Also takes a mutex, which is later used by wait(). If none is specified, a new mutex instance will be created. More...
|
|
void | signal () |
| Send a signal, which wakes up at least one of the waiting threads. More...
|
|
void | broadcast () |
| Send a signal, which wakes up any waiting threads. More...
|
|
void | wait () |
| Wait for a signal and release the lock in the meanwhile. More...
|
|
bool | wait (int ms) |
| Temporarily wait for a signal and release the lock in the meanwhile. More...
|
|
virtual const Class * | getClass () const |
| Retrieve this object's class. More...
|
|
| Object () |
| Construct a new object. More...
|
|
int | getRefCount () const |
| Return the current reference count. More...
|
|
void | incRef () const |
| Increase the reference count of the object by one. More...
|
|
void | decRef (bool autoDeallocate=true) const |
| Decrease the reference count of the object and possibly deallocate it. More...
|
|
virtual std::string | toString () const |
| Return a human-readable string representation of the object's contents. More...
|
|
Condition variable synchronization primitive. Can be used to wait for a condition to become true in a safe way.
mitsuba::ConditionVariable::ConditionVariable |
( |
Mutex * |
mutex = NULL | ) |
|
Create a new condition variable. Also takes a mutex, which is later used by wait(). If none is specified, a new mutex instance will be created.
virtual mitsuba::ConditionVariable::~ConditionVariable |
( |
| ) |
|
|
protectedvirtual |
void mitsuba::ConditionVariable::broadcast |
( |
| ) |
|
Send a signal, which wakes up any waiting threads.
The calling thread does not have to hold the lock, but more predictable scheduling will occur if this is the case.
virtual const Class* mitsuba::ConditionVariable::getClass |
( |
| ) |
const |
|
virtual |
Retrieve this object's class.
Reimplemented from Object.
void mitsuba::ConditionVariable::signal |
( |
| ) |
|
Send a signal, which wakes up at least one of the waiting threads.
The calling thread does not have to hold the lock, but more predictable scheduling will occur if this is the case.
void mitsuba::ConditionVariable::wait |
( |
| ) |
|
Wait for a signal and release the lock in the meanwhile.
Assumes that the lock specified in the constructor has previously been acquired. After returning, the lock is held again.
bool mitsuba::ConditionVariable::wait |
( |
int |
ms | ) |
|
Temporarily wait for a signal and release the lock in the meanwhile.
Similar to wait(), but also uses a time value given in milliseconds. A return value of false
signals that a timeout has occurred. The lock is held after returning in either case.
- Parameters
-
ms | Maximum waiting time in milliseconds |
Class* mitsuba::ConditionVariable::m_theClass |
|
static |
The documentation for this class was generated from the following file: