cCondWait Class Reference

#include <thread.h>

List of all members.

Public Member Functions

 cCondWait (void)
 ~cCondWait ()
bool Wait (int TimeoutMs=0)
void Signal (void)
 Signals a caller of Wait() that the condition it is waiting for is met.

Static Public Member Functions

static void SleepMs (int TimeoutMs)

Private Attributes

pthread_mutex_t mutex
pthread_cond_t cond
bool signaled


Detailed Description

Definition at line 17 of file thread.h.


Constructor & Destructor Documentation

cCondWait::cCondWait ( void   ) 

Definition at line 40 of file thread.c.

References cond, mutex, and signaled.

cCondWait::~cCondWait (  ) 

Definition at line 47 of file thread.c.

References cond, and mutex.


Member Function Documentation

void cCondWait::SleepMs ( int  TimeoutMs  )  [static]

Creates a cCondWait object and uses it to sleep for TimeoutMs milliseconds, immediately giving up the calling thread's time slice and thus avoiding a "busy wait". In order to avoid a possible busy wait, TimeoutMs will be automatically limited to values >2.

Definition at line 54 of file thread.c.

References max(), and Wait().

Referenced by cSectionHandler::Action(), cRecorder::Action(), cLircRemote::Action(), cDvbPlayer::Action(), cThread::Cancel(), cIndexFile::CatchUp(), cCiTransportLayer::cCiTransportLayer(), cPipe::Close(), cRcuRemote::DetectCode(), cDigiboxDevice::LircSend(), cCiTransportLayer::ResetSlot(), cDvbDevice::SetDigitalAudioDevice(), and cDiseqc::Wait().

Here is the call graph for this function:

bool cCondWait::Wait ( int  TimeoutMs = 0  ) 

Waits at most TimeoutMs milliseconds for a call to Signal(), or forever if TimeoutMs is 0.

Returns:
Returns true if Signal() has been called, false it the given timeout has expired.

Definition at line 60 of file thread.c.

References cond, GetAbsTime(), mutex, and signaled.

Referenced by cNonBlockingFileReader::Action(), SleepMs(), cRingBuffer::WaitForGet(), and cRingBuffer::WaitForPut().

Here is the call graph for this function:

void cCondWait::Signal ( void   ) 

Signals a caller of Wait() that the condition it is waiting for is met.

Definition at line 82 of file thread.c.

References cond, mutex, and signaled.

Referenced by cNonBlockingFileReader::Clear(), cRingBuffer::EnableGet(), cRingBuffer::EnablePut(), cNonBlockingFileReader::Read(), and cNonBlockingFileReader::~cNonBlockingFileReader().


Member Data Documentation

pthread_mutex_t cCondWait::mutex [private]

Definition at line 19 of file thread.h.

Referenced by cCondWait(), Signal(), Wait(), and ~cCondWait().

pthread_cond_t cCondWait::cond [private]

Definition at line 20 of file thread.h.

Referenced by cCondWait(), Signal(), Wait(), and ~cCondWait().

bool cCondWait::signaled [private]

Definition at line 21 of file thread.h.

Referenced by cCondWait(), Signal(), and Wait().


The documentation for this class was generated from the following files:
Generated on Tue Nov 6 20:06:34 2007 for VDR by  doxygen 1.5.3-20071008