![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
#include <ThreadPool.h>
Public Member Functions | |
| void | operator() () |
| ThreadPoolWorker (ThreadPool &threadPool) | |
Public Attributes | |
| ThreadPool & | _threadPool |
| boost::xtime | _waitTimeActive |
| boost::xtime | _waitTimeIdle |
Defines an object that performs work for the pool
Definition at line 61 of file Support/Include/ThreadPool.h.
| Support::ThreadPool::ThreadPoolWorker::ThreadPoolWorker | ( | ThreadPool & | threadPool | ) |
ThreadPoolWorker constructor
Definition at line 8 of file ThreadPool.cpp.
References _waitTimeActive, _waitTimeIdle, WorkerActiveWaitTimeInSeconds, and WorkerIdleWaitTimeInSeconds.
: _threadPool(threadPool) { _waitTimeActive.sec = WorkerActiveWaitTimeInSeconds; _waitTimeIdle.sec = WorkerIdleWaitTimeInSeconds; }
| void Support::ThreadPool::ThreadPoolWorker::operator() | ( | ) |
Implements the work done by a worker thread in the pool This causes them to sit in a loop and perform work off the queue
Definition at line 18 of file ThreadPool.cpp.
{
while(true)
{
//how long we wait after the task depends on if we have another
//even if we have another, it's good to sleep to surrender the CPU from time to time
if(_threadPool.consumeTask())
boost::thread::sleep(_waitTimeActive);
else
boost::thread::sleep(_waitTimeIdle);
}
}
Definition at line 63 of file Support/Include/ThreadPool.h.
Definition at line 64 of file Support/Include/ThreadPool.h.
Referenced by ThreadPoolWorker().
| boost::xtime Support::ThreadPool::ThreadPoolWorker::_waitTimeIdle |
Definition at line 65 of file Support/Include/ThreadPool.h.
Referenced by ThreadPoolWorker().
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.