UCommon
ucommon::Conditional Class Reference

The conditional is a common base for other thread synchronizing classes. More...

#include <condition.h>

Inheritance diagram for ucommon::Conditional:
Collaboration diagram for ucommon::Conditional:

Static Public Member Functions

static pthread_condattr_t * initializer (void)
 Support function for getting conditional attributes for realtime scheduling.
 
static void set (struct timespec *hires, timeout_t timeout)
 Convert a millisecond timeout into use for high resolution conditional timers.
 

Protected Member Functions

void broadcast (void)
 Signal the conditional to release all waiting threads.
 
 Conditional ()
 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.
 
 ~Conditional ()
 Destroy conditional, release any blocked threads.
 
- Protected Member Functions inherited from ucommon::ConditionMutex
 ConditionMutex ()
 Initialize and construct conditional.
 
void lock (void)
 Lock the conditional's supporting mutex.
 
void unlock (void)
 Unlock the conditional's supporting mutex.
 
 ~ConditionMutex ()
 Destroy conditional, release any blocked threads.
 

Protected Attributes

pthread_cond_t cond
 
- Protected Attributes inherited from ucommon::ConditionMutex
pthread_mutex_t mutex
 

Static Protected Attributes

static attribute attr
 

Friends

class autolock
 
class ConditionalAccess
 
class ConditionVar
 
class TimedEvent
 

Detailed Description

The conditional is a common base for other thread synchronizing classes.

Many of the complex sychronization objects, including barriers, semaphores, and various forms of read/write locks are all built from the conditional. This assures that the minimum functionality to build higher order thread synchronizing objects is a pure conditional, and removes dependencies on what may be optional features or functions that may have different behaviors on different pthread implimentations and platforms.

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

Definition at line 227 of file condition.h.

Member Function Documentation

◆ broadcast()

void ucommon::Conditional::broadcast ( void )
inlineprotected

Signal the conditional to release all waiting threads.

Definition at line 292 of file condition.h.

◆ initializer()

static pthread_condattr_t * ucommon::Conditional::initializer ( void )
inlinestatic

Support function for getting conditional attributes for realtime scheduling.

Returns
attributes to use for creating realtime conditionals.

Definition at line 316 of file condition.h.

◆ set()

static void ucommon::Conditional::set ( struct timespec * hires,
timeout_t timeout )
static

Convert a millisecond timeout into use for high resolution conditional timers.

Parameters
hirestimespec representation to set.
timeoutto convert.

◆ signal()

void ucommon::Conditional::signal ( void )
inlineprotected

Signal the conditional to release one waiting thread.

Definition at line 285 of file condition.h.

◆ wait() [1/3]

bool ucommon::Conditional::wait ( struct timespec * timeout)
protected

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::Conditional::wait ( timeout_t timeout)
protected

Conditional wait for signal on millisecond timeout.

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

◆ wait() [3/3]

void ucommon::Conditional::wait ( void )
inlineprotected

Wait (block) until signalled.

Definition at line 278 of file condition.h.

Friends And Related Symbol Documentation

◆ autolock

friend class autolock
friend

Definition at line 307 of file condition.h.

◆ ConditionalAccess

friend class ConditionalAccess
friend

Definition at line 233 of file condition.h.

◆ ConditionVar

friend class ConditionVar
friend

Definition at line 234 of file condition.h.

◆ TimedEvent

friend class TimedEvent
friend

Definition at line 253 of file condition.h.

Field Documentation

◆ attr

attribute ucommon::Conditional::attr
staticprotected

Definition at line 247 of file condition.h.

◆ cond

pthread_cond_t ucommon::Conditional::cond
mutableprotected

Definition at line 250 of file condition.h.


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