an executor which runs a thread More...
#include <thread_executor.h>
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< Cond > | cond |
| zmm::Ref< Mutex > | mutex |
| mt_atomic_t | _ref_count |
Static Private Member Functions | |
| static void * | staticThreadProc (void *arg) |
Private Attributes | |
| pthread_t | thread |
an executor which runs a thread
Definition at line 42 of file thread_executor.h.
| 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().
| 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
Implements Executor.
Definition at line 49 of file thread_executor.h.
References threadRunning.
| bool ThreadExecutor::kill | ( | ) | [virtual] |
kill the thread (pthread_join)
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] |
| void * Object::operator new | ( | size_t | size | ) | [static, inherited] |
| void Object::release | ( | ) | [inherited] |
Definition at line 66 of file object.cc.
References zmm::Object::_ref_count, atomic_dec(), and zmm::Object::mutex.
Referenced by zmm::ArrayBase::clear(), zmm::String::operator=(), DSOHash< zmm::Array< CacheObject > >::releaseData(), DSBHash< VT >::releaseData(), DSOHash< zmm::Array< CacheObject > >::remove(), zmm::ArrayBase::remove(), zmm::ArrayBase::removeUnordered(), zmm::ArrayBase::set(), zmm::ArrayBase::~ArrayBase(), DSOHash< zmm::Array< CacheObject > >::~DSOHash(), zmm::ObjectQueue< AutoscanDirectory >::~ObjectQueue(), zmm::ObjectStack< Element >::~ObjectStack(), and zmm::String::~String().
| void Object::retain | ( | ) | [inherited] |
Definition at line 58 of file object.cc.
References zmm::Object::_ref_count, atomic_inc(), and zmm::Object::mutex.
Referenced by zmm::ArrayBase::append(), zmm::ObjectQueue< AutoscanDirectory >::enqueue(), zmm::ArrayBase::insert(), zmm::String::operator=(), zmm::ObjectStack< Element >::push(), DSOHash< zmm::Array< CacheObject > >::put(), DSBHash< VT >::put(), zmm::ArrayBase::set(), and zmm::String::String().
| 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().
mt_atomic_t zmm::Object::_ref_count [protected, inherited] |
Definition at line 54 of file object.h.
Referenced by zmm::Object::getRefCount(), zmm::Object::Object(), zmm::Object::release(), and zmm::Object::retain().
zmm::Ref<Cond> ThreadExecutor::cond [protected] |
Definition at line 62 of file thread_executor.h.
Referenced by kill(), and ThreadExecutor().
zmm::Ref<Mutex> ThreadExecutor::mutex [protected] |
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().
bool ThreadExecutor::threadRunning [protected] |
if the thread is currently running
Definition at line 60 of file thread_executor.h.
Referenced by isAlive(), kill(), and startThread().
bool ThreadExecutor::threadShutdown [protected] |
Definition at line 58 of file thread_executor.h.
Referenced by kill(), ThreadExecutor(), and threadShutdownCheck().
1.6.1