NVIDIA Iray: Math API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::base::Condition Class Reference

Conditions allow threads to signal an event and to wait for such a signal, respectively. More...

Public Member Functions

 Condition ()
 Constructor. More...
 
 ~Condition ()
 Destructor. More...
 
void wait ()
 Waits for the condition to be signaled. More...
 
bool timed_wait (Float64 timeout)
 Waits for the condition to be signaled until a given timeout. More...
 
void signal ()
 Signals the condition. More...
 
void reset ()
 Resets the condition. More...
 

Detailed Description

Conditions allow threads to signal an event and to wait for such a signal, respectively.

Constructor & Destructor Documentation

mi::base::Condition::Condition ( )
inline

Constructor.

mi::base::Condition::~Condition ( )
inline

Destructor.

Member Function Documentation

void mi::base::Condition::reset ( )
inline

Resets the condition.

This will undo the effect of a signal() call if there was no outstanding wait() call.

void mi::base::Condition::signal ( )
inline

Signals the condition.

This will wake up one thread waiting for the condition. It does not matter if the call to signal() or wait() comes first.

Note
If there are two or more calls to signal() without a call to wait() in between (and no outstanding wait() call), all calls to signal() except the first one are ignored, i.e., calls to signal() do not increment some counter, but just set a flag.
bool mi::base::Condition::timed_wait ( Float64  timeout)
inline

Waits for the condition to be signaled until a given timeout.

If the condition is already signaled at this time the call will return immediately.

Parameters
timeoutMaximum time period (in seconds) to wait for the condition to be signaled.
Returns
true if the timeout was hit, and false if the condition was signaled.
void mi::base::Condition::wait ( )
inline

Waits for the condition to be signaled.

If the condition is already signaled at this time the call will return immediately.