23 #include "PoolThread.h"
25 void* PoolThread::run(
void *arg)
29 bool console = ths->console;
30 bool fl = ths->runFlag;
31 ths->m_mutex->unlock();
35 Task* task = ths->getTask();
50 ths->logger << e.what() << flush;
57 ths->m_mutex->unlock();
61 ths->m_mutex->unlock();
65 PoolThread::PoolThread(
bool console) {
66 logger = Logger::getLogger(
"PoolThread");
69 this->console = console;
70 this->complete =
false;
72 this->thrdStarted =
false;
74 mthread =
new Thread(&run,
this);
77 PoolThread::PoolThread() {
78 logger = Logger::getLogger(
"PoolThread");
81 this->console =
false;
82 this->thrdStarted =
false;
84 mthread =
new Thread(&run,
this);
87 PoolThread::~PoolThread() {
88 this->runFlag =
false;
90 bool fl = this->complete;
104 logger <<
"Destroyed PoolThread\n" << flush;
108 void PoolThread::execute() {
109 if(thrdStarted)
return;
116 void PoolThread::checkout(
Task *task)
122 this->mthread->interrupt();
126 void PoolThread::release()
134 bool PoolThread::isIdle()
142 Task* PoolThread::getTask()
144 this->m_mutex->lock();
145 Task* task = this->task;
146 this->m_mutex->unlock();