ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
TThreadPool< aTask, aParam > Class Template Reference

template<class aTask, class aParam>
class TThreadPool< aTask, aParam >

Definition at line 119 of file TThreadPool.h.

Public Member Functions

 TThreadPool (size_t threadsCount, bool needDbg=false)
 
 ~TThreadPool ()
 
void AddThread ()
 
void PushTask (typename TThreadPoolTask< aTask, aParam >::task_t &task, aParam param)
 
void Stop (bool processRemainingJobs=false)
 
void Drain ()
 
size_t TasksCount () const
 
size_t SuccessfulTasks () const
 
size_t IdleThreads () const
 

Private Types

typedef TThreadPoolTask< aTask,
aParam > 
task_t
 
typedef std::queue< task_t * > taskqueue_t
 
typedef std::vector< TThread * > threads_array_t
 

Private Member Functions

void DbgLog (const std::string &msg)
 

Static Private Member Functions

static voidMonitor (void *arg)
 
static voidExecutor (void *arg)
 
static voidJoinHelper (void *arg)
 
static bool IsThreadActive (TThread *pThread)
 

Private Attributes

taskqueue_t fTasks
 
TMutex fMutex
 
TConditionfThreadNeeded
 
TConditionfThreadAvailable
 
TMutex fMutexAllTasksDone
 
TConditionfAllTasksDone
 
threads_array_t fThreads
 
TThreadfThreadJoinHelper
 
TThreadfThreadMonitor
 
volatile bool fStopped
 
size_t fSuccessfulTasks
 
size_t fTasksCount
 
size_t fIdleThreads
 
TMutex fDbgOutputMutex
 
bool fSilent
 

Additional Inherited Members

- Protected Member Functions inherited from TNonCopyable
 TNonCopyable ()
 
 ~TNonCopyable ()
 

#include <TThreadPool.h>

Inheritance diagram for TThreadPool< aTask, aParam >:
[legend]

Member Typedef Documentation

template<class aTask, class aParam>
typedef TThreadPoolTask<aTask, aParam> TThreadPool< aTask, aParam >::task_t
private

Definition at line 121 of file TThreadPool.h.

template<class aTask, class aParam>
typedef std::queue<task_t*> TThreadPool< aTask, aParam >::taskqueue_t
private

Definition at line 122 of file TThreadPool.h.

template<class aTask, class aParam>
typedef std::vector<TThread*> TThreadPool< aTask, aParam >::threads_array_t
private

Definition at line 123 of file TThreadPool.h.

Constructor & Destructor Documentation

template<class aTask, class aParam>
TThreadPool< aTask, aParam >::TThreadPool ( size_t  threadsCount,
bool  needDbg = false 
)
inline

Definition at line 126 of file TThreadPool.h.

template<class aTask, class aParam>
TThreadPool< aTask, aParam >::~TThreadPool ( )
inline

Definition at line 150 of file TThreadPool.h.

Member Function Documentation

template<class aTask, class aParam>
void TThreadPool< aTask, aParam >::AddThread ( )
inline

Definition at line 165 of file TThreadPool.h.

template<class aTask, class aParam>
void TThreadPool< aTask, aParam >::DbgLog ( const std::string &  msg)
inlineprivate
template<class aTask, class aParam>
void TThreadPool< aTask, aParam >::Drain ( )
inline

Definition at line 215 of file TThreadPool.h.

Referenced by stressThreadPool().

template<class aTask, class aParam>
static void* TThreadPool< aTask, aParam >::Executor ( void arg)
inlinestaticprivate
template<class aTask, class aParam>
size_t TThreadPool< aTask, aParam >::IdleThreads ( ) const
inline

Definition at line 230 of file TThreadPool.h.

Referenced by TThreadPool< aTask, aParam >::Monitor().

template<class aTask, class aParam>
static bool TThreadPool< aTask, aParam >::IsThreadActive ( TThread pThread)
inlinestaticprivate

Definition at line 327 of file TThreadPool.h.

template<class aTask, class aParam>
static void* TThreadPool< aTask, aParam >::JoinHelper ( void arg)
inlinestaticprivate

Definition at line 317 of file TThreadPool.h.

Referenced by TThreadPool< aTask, aParam >::TThreadPool().

template<class aTask, class aParam>
static void* TThreadPool< aTask, aParam >::Monitor ( void arg)
inlinestaticprivate

Definition at line 235 of file TThreadPool.h.

Referenced by TThreadPool< aTask, aParam >::TThreadPool().

template<class aTask, class aParam>
void TThreadPool< aTask, aParam >::PushTask ( typename TThreadPoolTask< aTask, aParam >::task_t task,
aParam  param 
)
inline

Definition at line 173 of file TThreadPool.h.

Referenced by stressThreadPool(), and threadPool().

template<class aTask, class aParam>
void TThreadPool< aTask, aParam >::Stop ( bool  processRemainingJobs = false)
inline
template<class aTask, class aParam>
size_t TThreadPool< aTask, aParam >::SuccessfulTasks ( ) const
inline

Definition at line 226 of file TThreadPool.h.

template<class aTask, class aParam>
size_t TThreadPool< aTask, aParam >::TasksCount ( ) const
inline

Definition at line 222 of file TThreadPool.h.

Member Data Documentation

template<class aTask, class aParam>
TCondition* TThreadPool< aTask, aParam >::fAllTasksDone
private
template<class aTask, class aParam>
TMutex TThreadPool< aTask, aParam >::fDbgOutputMutex
private

Definition at line 353 of file TThreadPool.h.

Referenced by TThreadPool< aTask, aParam >::DbgLog().

template<class aTask, class aParam>
size_t TThreadPool< aTask, aParam >::fIdleThreads
private
template<class aTask, class aParam>
TMutex TThreadPool< aTask, aParam >::fMutex
private
template<class aTask, class aParam>
TMutex TThreadPool< aTask, aParam >::fMutexAllTasksDone
private
template<class aTask, class aParam>
bool TThreadPool< aTask, aParam >::fSilent
private

Definition at line 354 of file TThreadPool.h.

Referenced by TThreadPool< aTask, aParam >::DbgLog().

template<class aTask, class aParam>
volatile bool TThreadPool< aTask, aParam >::fStopped
private
template<class aTask, class aParam>
size_t TThreadPool< aTask, aParam >::fSuccessfulTasks
private
template<class aTask, class aParam>
taskqueue_t TThreadPool< aTask, aParam >::fTasks
private
template<class aTask, class aParam>
size_t TThreadPool< aTask, aParam >::fTasksCount
private
template<class aTask, class aParam>
TCondition* TThreadPool< aTask, aParam >::fThreadAvailable
private
template<class aTask, class aParam>
TThread* TThreadPool< aTask, aParam >::fThreadJoinHelper
private
template<class aTask, class aParam>
TThread* TThreadPool< aTask, aParam >::fThreadMonitor
private

Definition at line 348 of file TThreadPool.h.

Referenced by TThreadPool< aTask, aParam >::TThreadPool().

template<class aTask, class aParam>
TCondition* TThreadPool< aTask, aParam >::fThreadNeeded
private
template<class aTask, class aParam>
threads_array_t TThreadPool< aTask, aParam >::fThreads
private
Collaboration diagram for TThreadPool< aTask, aParam >:
[legend]

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