S3FC project page S3FC home page

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

s3_condition Class Reference

A condition variable that is implemented as a wrapper around the pthread_cond_t. More...

#include <s3_condition.h>

List of all members.

Public Methods

 s3_condition ()
 Default constructor: instantiate a new mutex. More...

 ~s3_condition ()
 Destructor: destroy the mutex primitive. More...

void wait (const s3_mutex &mutex) const
 Unlock mutex (as per s3_mutex::unlock() ) and wait. More...

void signal () const
 Signal the condition to a single (and arbitrary) thread waiting on the conditional. More...

void broadcast () const
 Signal the condition to all threads waiting on the conditional. More...


Protected Methods

 s3_condition (const s3_condition &src)
 Copy constructor: private for your convenience (thou shalt not copy construct an s3_condition - deal with it). More...

s3_condition & operator= (const s3_condition &src)
 Neither shalt thou copy assign an s3_condition. More...


Protected Attributes

pthread_cond_t cond
 The condition variable. More...


Detailed Description

A condition variable that is implemented as a wrapper around the pthread_cond_t.

A condition is a synchronisation primitive that allows a process to relinquish control of a shared resource until a condition is signalled, in which case it regains control of the resource. A condition variable is always associated with a mutex, that protects a shared resource. The condition supports the following operations:

Definition at line 55 of file s3_condition.h.


Constructor & Destructor Documentation

s3_condition::s3_condition  
 

Default constructor: instantiate a new mutex.

Definition at line 45 of file s3_condition.cc.

References cond.

s3_condition::~s3_condition  
 

Destructor: destroy the mutex primitive.

Definition at line 52 of file s3_condition.cc.

References cond, and CONST_OVERRIDE_COND_T.

s3_condition::s3_condition const s3_condition &    src [protected]
 

Copy constructor: private for your convenience (thou shalt not copy construct an s3_condition - deal with it).


Member Function Documentation

void s3_condition::broadcast   const
 

Signal the condition to all threads waiting on the conditional.

Definition at line 77 of file s3_condition.cc.

References cond, and CONST_OVERRIDE_COND_T.

s3_condition& s3_condition::operator= const s3_condition &    src [protected]
 

Neither shalt thou copy assign an s3_condition.

void s3_condition::signal   const
 

Signal the condition to a single (and arbitrary) thread waiting on the conditional.

Definition at line 71 of file s3_condition.cc.

References cond, and CONST_OVERRIDE_COND_T.

void s3_condition::wait const s3_mutex   mutex const
 

Unlock mutex (as per s3_mutex::unlock() ) and wait.

If the condition is signalled re-acquire the mutex (as per s3_mutex::lock() ) and proceed return. The mutex must be locked when entering this call.

Definition at line 63 of file s3_condition.cc.

References cond, CONST_OVERRIDE_COND_T, CONST_OVERRIDE_MUTEX_T, and s3_mutex::mutex.

Referenced by s3_inplace_fifo_mux::stub_queue::lock_select.


Member Data Documentation

pthread_cond_t s3_condition::cond [protected]
 

The condition variable.

Definition at line 61 of file s3_condition.h.

Referenced by broadcast, s3_condition, signal, wait, and ~s3_condition.


The documentation for this class was generated from the following files:
Send comments to: s3fc@stonethree.com SourceForge Logo