vdr 2.8.3
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

std::atomic< bool > active
std::atomic< bool > running
pthread_t childTid
std::atomic< tThreadId > childThreadId
cMutex mutex
char * description
bool lowPriority

Static Private Attributes

static tThreadId mainThreadId = 0

Friends

class cThreadLock

Detailed Description

Definition at line 86 of file thread.h.

Constructor & Destructor Documentation

◆ cThread()

◆ ~cThread()

cThread::~cThread ( )
virtual

Definition at line 275 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, cDirCopier, cDvbPlayer, cDvbSubtitleConverter, cDvbTuner, cEpgDataReader, cEpgDataWriter, cIndexFileGenerator, cKbdRemote, cLircDevRemote, cLircUsrRemote, cNonBlockingFileReader, cRecorder, cRecordingsHandler, cRemoveDeletedRecordingsThread, cSectionHandler, cSpinUpDisk, cSVDRPClientHandler, cSVDRPServerHandler, cTrueColorDemo, cTSBuffer, and cVideoDirectoryScannerThread.

Referenced by StartThread().

◆ Active()

◆ Cancel()

◆ IsMainThread()

◆ Lock()

◆ Running()

◆ SetDescription()

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

◆ SetIOPriority()

void cThread::SetIOPriority ( int Priority)
protected

Definition at line 287 of file thread.c.

References LOG_ERROR.

Referenced by StartThread().

◆ SetMainThreadId()

void cThread::SetMainThreadId ( void )
static

Definition at line 412 of file thread.c.

References esyslog, mainThreadId, and ThreadId().

Referenced by main().

◆ SetPriority()

void cThread::SetPriority ( int Priority)
protected

Definition at line 281 of file thread.c.

References LOG_ERROR.

Referenced by StartThread().

◆ Start()

◆ StartThread()

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

◆ ThreadId()

◆ Unlock()

◆ cThreadLock

friend class cThreadLock
friend

Definition at line 87 of file thread.h.

References cThreadLock.

Referenced by cThreadLock.

Member Data Documentation

◆ active

std::atomic<bool> cThread::active
private

Definition at line 91 of file thread.h.

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

◆ childThreadId

std::atomic<tThreadId> cThread::childThreadId
private

Definition at line 94 of file thread.h.

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

◆ childTid

pthread_t cThread::childTid
private

Definition at line 93 of file thread.h.

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

◆ description

char* cThread::description
private

◆ lowPriority

bool cThread::lowPriority
private

Definition at line 97 of file thread.h.

Referenced by cThread(), and StartThread().

◆ mainThreadId

tThreadId cThread::mainThreadId = 0
staticprivate

Definition at line 98 of file thread.h.

Referenced by IsMainThread(), and SetMainThreadId().

◆ mutex

cMutex cThread::mutex
private

Definition at line 95 of file thread.h.

Referenced by Lock(), and Unlock().

◆ running

std::atomic<bool> cThread::running
private

Definition at line 92 of file thread.h.

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


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