UCommon
ucommon::ConditionVar Class Reference

The condition Var allows multiple conditions to share a mutex. More...

#include <condition.h>

Collaboration diagram for ucommon::ConditionVar:

Public Member Functions

void broadcast (void)
 Signal the conditional to release all waiting threads.
 
 ConditionVar (ConditionMutex *mutex)
 Initialize and construct conditional.
 
void signal (void)
 Signal the conditional to release one waiting thread.
 
bool wait (struct timespec *timeout)
 Conditional wait for signal on timespec timeout.
 
bool wait (timeout_t timeout)
 Conditional wait for signal on millisecond timeout.
 
void wait (void)
 Wait (block) until signalled.
 
 ~ConditionVar ()
 Destroy conditional, release any blocked threads.
 

Protected Attributes

pthread_cond_t cond
 
ConditionMutexshared
 

Friends

class ConditionList
 

Detailed Description

The condition Var allows multiple conditions to share a mutex.

This can be used to form specialized thread synchronizing classes such as ordered sempahores, or to create thread completion lists.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 148 of file condition.h.

Member Function Documentation

◆ broadcast()

void ucommon::ConditionVar::broadcast ( void )
inline

Signal the conditional to release all waiting threads.

Definition at line 211 of file condition.h.

◆ signal()

void ucommon::ConditionVar::signal ( void )
inline

Signal the conditional to release one waiting thread.

Definition at line 204 of file condition.h.

◆ wait() [1/3]

bool ucommon::ConditionVar::wait ( struct timespec * timeout)

Conditional wait for signal on timespec timeout.

Parameters
timeoutas a high resolution timespec.
Returns
true if signalled, false if timer expired.

◆ wait() [2/3]

bool ucommon::ConditionVar::wait ( timeout_t timeout)

Conditional wait for signal on millisecond timeout.

Parameters
timeoutin milliseconds.
Returns
true if signalled, false if timer expired.

◆ wait() [3/3]

void ucommon::ConditionVar::wait ( void )
inline

Wait (block) until signalled.

Definition at line 197 of file condition.h.

Friends And Related Symbol Documentation

◆ ConditionList

friend class ConditionList
friend

Definition at line 154 of file condition.h.

Field Documentation

◆ cond

pthread_cond_t ucommon::ConditionVar::cond
mutableprotected

Definition at line 159 of file condition.h.

◆ shared

ConditionMutex* ucommon::ConditionVar::shared
protected

Definition at line 161 of file condition.h.


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