libDwm-0.6.0
Dwm::Pthread::ConditionVariable Class Reference

This class just encapsulates a condition variable (from the pthread library), with default attributes. More...

#include <DwmConditionVariable.hh>

Public Member Functions

 ConditionVariable ()
 Constructor, initializes the condition variable.
 
 ~ConditionVariable ()
 Destructor, destroys the condition variable.
 
bool Broadcast ()
 Unblocks all threads waiting for the condition variable. More...
 
bool Signal ()
 Unblocks one thread waiting for the condition variable. More...
 
bool TimedWait (Mutex &mutex, const struct timespec *abstime)
 Atomically blocks the calling thread waiting on the condition variable, and unblocks the mutex specified by mutex. More...
 
bool Wait (Mutex &mutex)
 Atomically blocks the current thread waiting on the condition variable, and unblocks the mutex specified by mutex. More...
 

Protected Attributes

pthread_cond_t _cv
 

Detailed Description

This class just encapsulates a condition variable (from the pthread library), with default attributes.

Member Function Documentation

◆ Broadcast()

bool Dwm::Pthread::ConditionVariable::Broadcast ( )

Unblocks all threads waiting for the condition variable.

Returns true on success.

◆ Signal()

bool Dwm::Pthread::ConditionVariable::Signal ( )

Unblocks one thread waiting for the condition variable.

Returns true on success.

◆ TimedWait()

bool Dwm::Pthread::ConditionVariable::TimedWait ( Mutex mutex,
const struct timespec *  abstime 
)

Atomically blocks the calling thread waiting on the condition variable, and unblocks the mutex specified by mutex.

The waiting thread unblocks only after another thread calls Signal(), or Broadcast() on the same object, or if the system time reaches the time specified in abstime, and the current thread reacquires the lock on mutex.

◆ Wait()

bool Dwm::Pthread::ConditionVariable::Wait ( Mutex mutex)

Atomically blocks the current thread waiting on the condition variable, and unblocks the mutex specified by mutex.

The waiting thread unblocks only after another thread calls Signal() or Broadcast() on the same object, and the current thread reacquires the lock on mutex.


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