UCommon
Public Member Functions | Protected Attributes | Friends
ucommon::ConditionVar Class Reference

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

#include <condition.h>

Collaboration diagram for ucommon::ConditionVar:
Collaboration graph
[legend]

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 (timeout_t timeout)
 Conditional wait for signal on millisecond timeout. More...
 
bool wait (struct timespec *timeout)
 Conditional wait for signal on timespec timeout. More...
 
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

◆ wait() [1/2]

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() [2/2]

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.

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