ThreadExecutor Class Reference

an executor which runs a thread More...

#include <thread_executor.h>

Inheritance diagram for ThreadExecutor:
Executor zmm::Object IOHandlerChainer MPEGRemuxProcessor

Public Member Functions

 ThreadExecutor ()
 initialize the mutex and the cond
virtual ~ThreadExecutor ()
virtual bool isAlive ()
 method to check if the executor is still running
virtual bool kill ()
 kill the thread (pthread_join)
virtual int getStatus ()=0
 the exit status of the thread - needs to be overridden
void retain ()
void release ()
int getRefCount ()

Static Public Member Functions

static void * operator new (size_t size)
static void operator delete (void *ptr)

Protected Member Functions

virtual void threadProc ()=0
 abstract thread method, which needs to be overridden
void startThread ()
 start the thread
bool threadShutdownCheck ()
 check if the thread should shutdown should be called by the threadProc in short intervals

Protected Attributes

bool threadShutdown
bool threadRunning
 if the thread is currently running
zmm::Ref< Condcond
zmm::Ref< Mutexmutex
mt_atomic_t _ref_count

Static Private Member Functions

static void * staticThreadProc (void *arg)

Private Attributes

pthread_t thread

Detailed Description

an executor which runs a thread

Definition at line 42 of file thread_executor.h.


Constructor & Destructor Documentation

ThreadExecutor::ThreadExecutor (  ) 

initialize the mutex and the cond

Definition at line 40 of file thread_executor.cc.

References cond, mutex, and threadShutdown.

ThreadExecutor::~ThreadExecutor (  )  [virtual]

Definition at line 48 of file thread_executor.cc.

References kill().


Member Function Documentation

int Object::getRefCount (  )  [inherited]

Definition at line 78 of file object.cc.

References zmm::Object::_ref_count, and atomic_get().

virtual int ThreadExecutor::getStatus (  )  [pure virtual]

the exit status of the thread - needs to be overridden

Implements Executor.

Implemented in IOHandlerChainer, and MPEGRemuxProcessor.

virtual bool ThreadExecutor::isAlive (  )  [inline, virtual]

method to check if the executor is still running

Returns:
true if the executor is still running, false otherwise

Implements Executor.

Definition at line 49 of file thread_executor.h.

References threadRunning.

bool ThreadExecutor::kill (  )  [virtual]

kill the thread (pthread_join)

Returns:
always true - this function only returns after the thread has died

Implements Executor.

Definition at line 64 of file thread_executor.cc.

References AUTOLOCK, AUTOUNLOCK, cond, mutex, NULL, thread, threadRunning, and threadShutdown.

Referenced by ~ThreadExecutor().

void Object::operator delete ( void *  ptr  )  [static, inherited]

Definition at line 87 of file object.cc.

References FREE.

void * Object::operator new ( size_t  size  )  [static, inherited]

Definition at line 83 of file object.cc.

References MALLOC.

void Object::release (  )  [inherited]
void Object::retain (  )  [inherited]
void ThreadExecutor::startThread (  )  [protected]

start the thread

Definition at line 53 of file thread_executor.cc.

References NULL, staticThreadProc(), thread, and threadRunning.

Referenced by IOHandlerChainer::IOHandlerChainer().

void * ThreadExecutor::staticThreadProc ( void *  arg  )  [static, private]

Definition at line 80 of file thread_executor.cc.

References NULL, and threadProc().

Referenced by startThread().

virtual void ThreadExecutor::threadProc (  )  [protected, pure virtual]

abstract thread method, which needs to be overridden

Implemented in IOHandlerChainer, and MPEGRemuxProcessor.

Referenced by staticThreadProc().

bool ThreadExecutor::threadShutdownCheck (  )  [inline, protected]

check if the thread should shutdown should be called by the threadProc in short intervals

Definition at line 73 of file thread_executor.h.

References threadShutdown.

Referenced by IOHandlerChainer::threadProc().


Field Documentation

mt_atomic_t zmm::Object::_ref_count [protected, inherited]

Definition at line 62 of file thread_executor.h.

Referenced by kill(), and ThreadExecutor().

Reimplemented from zmm::Object.

Definition at line 63 of file thread_executor.h.

Referenced by kill(), and ThreadExecutor().

pthread_t ThreadExecutor::thread [private]

Definition at line 73 of file thread_executor.h.

Referenced by kill(), and startThread().

if the thread is currently running

Definition at line 60 of file thread_executor.h.

Referenced by isAlive(), kill(), and startThread().

Definition at line 58 of file thread_executor.h.

Referenced by kill(), ThreadExecutor(), and threadShutdownCheck().


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

Generated on Fri Mar 26 20:16:57 2010 for MediaTomb by  doxygen 1.6.1