neuray API Programmer's Manual

mi::base::Condition Class Reference

[Multithreading Support]

Description

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

Public Constructors

 Condition()
Constructor.

Public Destructors

 ~Condition()
Destructor.

Public Member Functions

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

Constructors

mi::​base::​Condition::Condition() [inline]

Constructor.

Destructors

mi::​base::​Condition::~Condition() [inline]

Destructor.

Member Functions

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

timeout
Maximum 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.