This class implements a portable inter‐thread signaling primitive.

Synopsis

Declared in <bslmt_condition.h>

class Condition;

Enums

Name

Description

Unnamed enum

The value timedWait returns when a timeout occurs.

Member Functions

Name

Description

Condition [constructor]

Constructors

~Condition [destructor]

Destroy this condition variable object.

broadcast

Signal this condition variable object by waking up all threads that are currently waiting on this condition. If there are no threads waiting on this condition, this method has no effect.

clockType

Return the clock type used for timeouts.

signal

Signal this condition variable object by waking up a single thread that is currently waiting on this condition. If there are no threads waiting on this condition, this method has no effect.

timedWait

timedWait overloads

wait

Atomically unlock the specified mutex and suspend execution of the current thread until this condition object is "signaled" (i.e., either signal or broadcast is invoked on this object in another thread), then re‐acquire a lock on the mutex. Return 0 on success, and a non‐zero value otherwise. Spurious wakeups are rare but possible; i.e., this method may succeed (return 0), and return control to the thread without the condition object being signaled. The behavior is undefined unless mutex is locked by the calling thread prior to calling this method. Note that mutex remains locked by the calling thread upon return from this function.

Created with MrDocs