gets two IOHandler, starts a thread which reads from one IOHandler and writes the data to the other IOHandler More...
#include <io_handler_chainer.h>
Public Member Functions | |
| IOHandlerChainer (zmm::Ref< IOHandler > readFrom, zmm::Ref< IOHandler > writeTo, int chunkSize) | |
| initialize the IOHandlerChainer | |
| virtual int | getStatus () |
| the exit status of the thread - needs to be overridden | |
| virtual bool | isAlive () |
| method to check if the executor is still running | |
| virtual bool | kill () |
| kill the thread (pthread_join) | |
| 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 () |
| 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 |
Private Attributes | |
| int | status |
| char * | buf |
| int | chunkSize |
| zmm::Ref< IOHandler > | readFrom |
| zmm::Ref< IOHandler > | writeTo |
gets two IOHandler, starts a thread which reads from one IOHandler and writes the data to the other IOHandler
Definition at line 47 of file io_handler_chainer.h.
| IOHandlerChainer::IOHandlerChainer | ( | zmm::Ref< IOHandler > | readFrom, | |
| zmm::Ref< IOHandler > | writeTo, | |||
| int | chunkSize | |||
| ) |
initialize the IOHandlerChainer
| readFrom | the IOHandler to read from | |
| writeTo | the IOHandler to write to | |
| chunkSize | the amount of bytes to read/write at once. a buffer of this size will be allocated |
Definition at line 41 of file io_handler_chainer.cc.
References _, _Exception, buf, MALLOC, NULL, ThreadExecutor::startThread(), status, and UPNP_READ.
| int Object::getRefCount | ( | ) | [inherited] |
Definition at line 78 of file object.cc.
References zmm::Object::_ref_count, and atomic_get().
| virtual int IOHandlerChainer::getStatus | ( | ) | [inline, virtual] |
the exit status of the thread - needs to be overridden
Implements ThreadExecutor.
Definition at line 56 of file io_handler_chainer.h.
References status.
| virtual bool ThreadExecutor::isAlive | ( | ) | [inline, virtual, inherited] |
method to check if the executor is still running
Implements Executor.
Definition at line 49 of file thread_executor.h.
References ThreadExecutor::threadRunning.
| bool ThreadExecutor::kill | ( | ) | [virtual, inherited] |
kill the thread (pthread_join)
Implements Executor.
Definition at line 64 of file thread_executor.cc.
References AUTOLOCK, AUTOUNLOCK, ThreadExecutor::cond, ThreadExecutor::mutex, NULL, ThreadExecutor::thread, ThreadExecutor::threadRunning, and ThreadExecutor::threadShutdown.
Referenced by ThreadExecutor::~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, inherited] |
start the thread
Definition at line 53 of file thread_executor.cc.
References NULL, ThreadExecutor::staticThreadProc(), ThreadExecutor::thread, and ThreadExecutor::threadRunning.
Referenced by IOHandlerChainer().
| void IOHandlerChainer::threadProc | ( | ) | [protected, virtual] |
abstract thread method, which needs to be overridden
Implements ThreadExecutor.
Definition at line 56 of file io_handler_chainer.cc.
References buf, zmm::String::c_str(), chunkSize, zmm::Exception::getMessage(), IOHC_EXCEPTION, IOHC_FORCED_SHUTDOWN, IOHC_NORMAL_SHUTDOWN, IOHC_READ_ERROR, IOHC_WRITE_ERROR, log_debug, readFrom, status, ThreadExecutor::threadShutdownCheck(), UPNP_WRITE, and writeTo.
| bool ThreadExecutor::threadShutdownCheck | ( | ) | [inline, protected, inherited] |
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 ThreadExecutor::threadShutdown.
Referenced by 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().
char* IOHandlerChainer::buf [private] |
Definition at line 61 of file io_handler_chainer.h.
Referenced by IOHandlerChainer(), and threadProc().
int IOHandlerChainer::chunkSize [private] |
Definition at line 62 of file io_handler_chainer.h.
Referenced by threadProc().
zmm::Ref<Cond> ThreadExecutor::cond [protected, inherited] |
Definition at line 62 of file thread_executor.h.
Referenced by ThreadExecutor::kill(), and ThreadExecutor::ThreadExecutor().
zmm::Ref<Mutex> ThreadExecutor::mutex [protected, inherited] |
Reimplemented from zmm::Object.
Definition at line 63 of file thread_executor.h.
Referenced by ThreadExecutor::kill(), and ThreadExecutor::ThreadExecutor().
zmm::Ref<IOHandler> IOHandlerChainer::readFrom [private] |
Definition at line 63 of file io_handler_chainer.h.
Referenced by threadProc().
int IOHandlerChainer::status [private] |
Definition at line 60 of file io_handler_chainer.h.
Referenced by getStatus(), IOHandlerChainer(), and threadProc().
bool ThreadExecutor::threadRunning [protected, inherited] |
if the thread is currently running
Definition at line 60 of file thread_executor.h.
Referenced by ThreadExecutor::isAlive(), ThreadExecutor::kill(), and ThreadExecutor::startThread().
bool ThreadExecutor::threadShutdown [protected, inherited] |
Definition at line 58 of file thread_executor.h.
Referenced by ThreadExecutor::kill(), ThreadExecutor::ThreadExecutor(), and ThreadExecutor::threadShutdownCheck().
zmm::Ref<IOHandler> IOHandlerChainer::writeTo [private] |
Definition at line 64 of file io_handler_chainer.h.
Referenced by threadProc().
1.6.1