RTP Audio System  2.0.0
Condition Class Reference

Condition. More...

#include <condition.h>

Inheritance diagram for Condition:
Synchronizable MessageQueue< T > RingBuffer

List of all members.

Public Member Functions

 Condition (const char *name="Condition", Condition *parentCondition=NULL, const bool recursive=true)
 ~Condition ()
void signal ()
void broadcast ()
bool fired ()
bool peekFired ()
void wait ()
bool timedWait (const card64 microseconds)
void addParent (Condition *parentCondition)
void removeParent (Condition *parentCondition)

Private Attributes

std::set< Condition * > ParentSet
pthread_cond_t ConditionVariable
bool Fired
bool Valid

Detailed Description

Condition.

This class realizes a condition variable.

Author:
Thomas Dreibholz
Version:
1.0
See also:
Synchronizable
Thread

Constructor & Destructor Documentation

Condition::Condition ( const char *  name = "Condition",
Condition parentCondition = NULL,
const bool  recursive = true 
)

Constructor.

Parameters:
nameName.
parentConditionParent condition.
recursivetrue to make condition's mutex recursive; false otherwise (default for Condition!).

Destructor.


Member Function Documentation

void Condition::addParent ( Condition parentCondition)

Add parent condition.

Parameters:
parentConditionParent condition to be added.

Broadcast condition: All threads waiting for this variable will be resumed.

bool Condition::fired ( ) [inline]

Check, if condition has been fired. This call will reset the fired state.

Returns:
true, if condition has been fired; false otherwise.
bool Condition::peekFired ( ) [inline]

Check, if condition has been fired. This call will *not* reset the fired state.

Returns:
true, if condition has been fired; false otherwise.
void Condition::removeParent ( Condition parentCondition)

Remove parent condition.

Parameters:
parentConditionParent condition to be removed.

Fire condition: One thread waiting for this variable will be resumed.

bool Condition::timedWait ( const card64  microseconds)

Wait for condition with timeout.

Parameters:
microsecondsTimeout in microseconds.
Returns:
true, if condition has been received; false for timeout.
void Condition::wait ( )

Wait for condition without timeout.


Member Data Documentation

pthread_cond_t Condition::ConditionVariable [private]
bool Condition::Fired [private]
std::set<Condition*> Condition::ParentSet [private]
bool Condition::Valid [private]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines