Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::ConditionVariable Class Reference

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>

+ Inheritance diagram for mitsuba::ConditionVariable:

Public Member Functions

 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 ClassgetClass () const
 Retrieve this object's class. More...
 
- Public Member Functions inherited from Object
 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...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

virtual ~ConditionVariable ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 

Detailed Description

Condition variable synchronization primitive. Can be used to wait for a condition to become true in a safe way.

Constructor & Destructor Documentation

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

Virtual destructor.

Member Function Documentation

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
msMaximum waiting time in milliseconds

Member Data Documentation

Class* mitsuba::ConditionVariable::m_theClass
static

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