ThreadPool Class Reference

#include <ThreadPool.h>

Collaboration diagram for ThreadPool:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ThreadPool (int maxNumThreads)
virtual ~ThreadPool ()
int dispatch (int id, ThreadPoolJob &f)
void waitAll ()
int getNumThreads ()
 returns number of threads which it holds

Protected Attributes

int _maxNumThreads
std::vector< thread * > threads
std::vector< WorkerState * > workerstates
std::vector< condition * > cond1
std::vector< condition * > cond2
std::vector< mutex * > mtx1
std::vector< mutex * > mtx2


Detailed Description

Definition at line 68 of file ThreadPool.h.


Constructor & Destructor Documentation

ThreadPool::ThreadPool ( int  maxNumThreads  ) 

Definition at line 54 of file ThreadPool.cpp.

References _maxNumThreads, cond1, cond2, mtx1, mtx2, threads, and workerstates.

ThreadPool::~ThreadPool (  )  [virtual]

Definition at line 99 of file ThreadPool.cpp.

References _maxNumThreads, cond1, cond2, mtx1, mtx2, threads, and workerstates.


Member Function Documentation

int ThreadPool::dispatch ( int  id,
ThreadPoolJob f 
)

void ThreadPool::waitAll (  ) 

int ThreadPool::getNumThreads (  )  [inline]

returns number of threads which it holds

Definition at line 88 of file ThreadPool.h.

References _maxNumThreads.

Referenced by MTDistributedCycledAnalogMsgDispatcher::dispatchDelayerCycledIncomingAnalogMsgs().


Member Data Documentation

Definition at line 93 of file ThreadPool.h.

Referenced by getNumThreads(), ThreadPool(), waitAll(), and ~ThreadPool().

std::vector<thread*> ThreadPool::threads [protected]

Definition at line 95 of file ThreadPool.h.

Referenced by ThreadPool(), and ~ThreadPool().

std::vector<WorkerState*> ThreadPool::workerstates [protected]

Definition at line 96 of file ThreadPool.h.

Referenced by dispatch(), ThreadPool(), and ~ThreadPool().

std::vector<condition*> ThreadPool::cond1 [protected]

Definition at line 97 of file ThreadPool.h.

Referenced by dispatch(), ThreadPool(), and ~ThreadPool().

std::vector<condition*> ThreadPool::cond2 [protected]

Definition at line 98 of file ThreadPool.h.

Referenced by dispatch(), ThreadPool(), and ~ThreadPool().

std::vector<mutex*> ThreadPool::mtx1 [protected]

Definition at line 99 of file ThreadPool.h.

Referenced by dispatch(), ThreadPool(), and ~ThreadPool().

std::vector<mutex*> ThreadPool::mtx2 [protected]

Definition at line 100 of file ThreadPool.h.

Referenced by ThreadPool(), waitAll(), and ~ThreadPool().


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

Generated on Wed Jul 9 16:34:55 2008 for PCSIM by  doxygen 1.5.5