vdr 2.6.9
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
cThread Class Referenceabstract

#include <thread.h>

Public Member Functions

 cThread (const char *Description=NULL, bool LowPriority=false)
 
virtual ~cThread ()
 
void SetDescription (const char *Description,...) __attribute__((format(printf
 
void bool Start (void)
 
bool Active (void)
 

Static Public Member Functions

static tThreadId ThreadId (void)
 
static tThreadId IsMainThread (void)
 
static void SetMainThreadId (void)
 

Protected Member Functions

void SetPriority (int Priority)
 
void SetIOPriority (int Priority)
 
void Lock (void)
 
void Unlock (void)
 
virtual void Action (void)=0
 
bool Running (void)
 
void Cancel (int WaitSeconds=0)
 

Static Private Member Functions

static void * StartThread (cThread *Thread)
 

Private Attributes

bool active
 
bool running
 
pthread_t childTid
 
tThreadId childThreadId
 
cMutex mutex
 
char * description
 
bool lowPriority
 

Static Private Attributes

static tThreadId mainThreadId = 0
 

Friends

class cThreadLock
 

Detailed Description

Definition at line 79 of file thread.h.

Constructor & Destructor Documentation

◆ cThread()

cThread::cThread ( const char * Description = NULL,
bool LowPriority = false )

Creates a new thread.

If Description is present, a log file entry will be made when the thread starts and stops (see SetDescription()). The Start() function must be called to actually start the thread. LowPriority can be set to true to make this thread run at a lower priority.

Definition at line 238 of file thread.c.

References active, childThreadId, childTid, description, lowPriority, running, and SetDescription().

◆ ~cThread()

cThread::~cThread ( )
virtual

Definition at line 249 of file thread.c.

References Cancel(), and description.

Member Function Documentation

◆ Action()

virtual void cThread::Action ( void )
protectedpure virtual

A derived cThread class must implement the code it wants to execute as a separate thread in this function.

If this is a loop, it must check Running() repeatedly to see whether it's time to stop.

Implemented in cCiAdapter, cCuttingThread, cDevice, cTSBuffer, cDvbTuner, cNonBlockingFileReader, cDvbPlayer, cDvbSubtitleConverter, cEpgDataWriter, cEpgDataReader, cLircUsrRemote, cLircDevRemote, cTrueColorDemo, cRcuRemote, cRecorder, cRemoveDeletedRecordingsThread, cVideoDirectoryScannerThread, cDirCopier, cIndexFileGenerator, cRecordingsHandler, cKbdRemote, cSectionHandler, cSVDRPClientHandler, and cSVDRPServerHandler.

Referenced by StartThread().

◆ Active()

bool cThread::Active ( void )

◆ Cancel()

void cThread::Cancel ( int WaitSeconds = 0)
protected

◆ IsMainThread()

static tThreadId cThread::IsMainThread ( void )
inlinestatic

◆ Lock()

void cThread::Lock ( void )
inlineprotected

◆ Running()

bool cThread::Running ( void )
inlineprotected

◆ SetDescription()

void cThread::SetDescription ( const char * Description,
... )

◆ SetIOPriority()

void cThread::SetIOPriority ( int Priority)
protected

Definition at line 261 of file thread.c.

References LOG_ERROR.

Referenced by StartThread().

◆ SetMainThreadId()

void cThread::SetMainThreadId ( void )
static

Definition at line 377 of file thread.c.

References esyslog, mainThreadId, and ThreadId().

Referenced by main().

◆ SetPriority()

void cThread::SetPriority ( int Priority)
protected

Definition at line 255 of file thread.c.

References LOG_ERROR.

Referenced by StartThread().

◆ Start()

bool cThread::Start ( void )

◆ StartThread()

void * cThread::StartThread ( cThread * Thread)
staticprivate

Definition at line 279 of file thread.c.

References Action(), active, childThreadId, description, dsyslog, esyslog, lowPriority, running, SetIOPriority(), SetPriority(), and ThreadId().

Referenced by Start().

◆ ThreadId()

tThreadId cThread::ThreadId ( void )
static

◆ Unlock()

void cThread::Unlock ( void )
inlineprotected

Friends And Related Symbol Documentation

◆ cThreadLock

friend class cThreadLock
friend

Definition at line 80 of file thread.h.

Member Data Documentation

◆ active

bool cThread::active
private

Definition at line 82 of file thread.h.

Referenced by Active(), Cancel(), cThread(), Start(), and StartThread().

◆ childThreadId

tThreadId cThread::childThreadId
private

Definition at line 85 of file thread.h.

Referenced by Cancel(), cThread(), and StartThread().

◆ childTid

pthread_t cThread::childTid
private

Definition at line 84 of file thread.h.

Referenced by Active(), Cancel(), cThread(), and Start().

◆ description

char* cThread::description
private

◆ lowPriority

bool cThread::lowPriority
private

Definition at line 88 of file thread.h.

Referenced by cThread(), and StartThread().

◆ mainThreadId

tThreadId cThread::mainThreadId = 0
staticprivate

Definition at line 89 of file thread.h.

Referenced by IsMainThread(), and SetMainThreadId().

◆ mutex

cMutex cThread::mutex
private

Definition at line 86 of file thread.h.

Referenced by Lock(), and Unlock().

◆ running

bool cThread::running
private

Definition at line 83 of file thread.h.

Referenced by Active(), Cancel(), cThread(), Running(), Start(), and StartThread().


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