ucc::Conditional Class Reference

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

#include <thread.h>

Inheritance diagram for ucc::Conditional:
Inheritance graph
[legend]

Static Public Member Functions

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

Protected Member Functions

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

Friends

class ConditionalAccess
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@gnutelephony.org>

Definition at line 86 of file thread.h.


Member Function Documentation

static void ucc::Conditional::gettimeout ( timeout_t  timeout,
struct timespec *  hires 
) [static]

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

Parameters:
timeout to convert.
hires timespec representation to fill.

Reimplemented in ucc::ConditionalAccess.

static pthread_condattr_t* ucc::Conditional::initializer ( void   )  [inline, static]

Support function for getting conditional attributes for realtime scheduling.

Returns:
attributes to use for creating realtime conditionals.

Definition at line 190 of file thread.h.

bool ucc::Conditional::wait ( struct timespec *  timeout  )  [protected]

Conditional wait for signal on timespec timeout.

Parameters:
timeout as a high resolution timespec.
Returns:
true if signalled, false if timer expired.
bool ucc::Conditional::wait ( timeout_t  timeout  )  [protected]

Conditional wait for signal on millisecond timeout.

Parameters:
timeout in milliseconds.
Returns:
true if signalled, false if timer expired.

Reimplemented in ucc::barrier, and ucc::semaphore.


The documentation for this class was generated from the following file:
Generated by  doxygen 1.6.2-20100208