vdr  1.7.27
Public Member Functions | Static Public Member Functions | Private Attributes
cCondWait Class Reference

#include <thread.h>

List of all members.

Public Member Functions

 cCondWait (void)
 ~cCondWait ()
bool Wait (int TimeoutMs=0)
void Signal (void)
 cCondWait (void)
 ~cCondWait ()
bool Wait (int TimeoutMs=0)
void Signal (void)

Static Public Member Functions

static void SleepMs (int TimeoutMs)
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 include/vdr/thread.h.


Constructor & Destructor Documentation

Definition at line 43 of file thread.c.

References cond, mutex, and signaled.

Definition at line 50 of file thread.c.

References cond, and mutex.


Member Function Documentation

void cCondWait::Signal ( void  )

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

Definition at line 85 of file thread.c.

References cond, mutex, and signaled.

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

void cCondWait::Signal ( void  )

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

static 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.

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 57 of file thread.c.

References max(), and Wait().

Referenced by cLircRemote::Action(), cSectionHandler::Action(), cDvbSubtitleConverter::Action(), cTrueColorDemo::Action(), cDvbPlayer::Action(), cThread::Cancel(), cIndexFile::CatchUp(), cIndexFile::cIndexFile(), cPipe::Close(), CutRecording(), cRcuRemote::DetectCode(), GenerateIndex(), cRecordControl::GetEvent(), cLockFile::Lock(), cMenuSetupCAM::Menu(), cInterface::QueryKeys(), cTransfer::Receive(), cDvbSdFfDevice::SetDigitalAudioDevice(), cThread::Start(), cDiseqc::Wait(), and cDevice::WaitForAllDevicesReady().

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 63 of file thread.c.

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

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

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.

Member Data Documentation

pthread_cond_t cCondWait::cond [private]

Definition at line 20 of file include/vdr/thread.h.

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

pthread_mutex_t cCondWait::mutex [private]

Definition at line 19 of file include/vdr/thread.h.

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

bool cCondWait::signaled [private]

Definition at line 21 of file include/vdr/thread.h.

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


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