Logo ROOT   6.10/09
Reference Guide
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 113 of file TThreadPool.h.

Public Member Functions

 TThreadPool (size_t threadsCount, bool needDbg=false)
 
 ~TThreadPool ()
 
void AddThread ()
 
void Drain ()
 
size_t IdleThreads () const
 
void PushTask (typename TThreadPoolTask< aTask, aParam >::task_t &task, aParam param)
 
void Stop (bool processRemainingJobs=false)
 
size_t SuccessfulTasks () const
 
size_t TasksCount () 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 voidExecutor (void *arg)
 
static bool IsThreadActive (TThread *pThread)
 
static voidJoinHelper (void *arg)
 
static voidMonitor (void *arg)
 

Private Attributes

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

Additional Inherited Members

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

#include <TThreadPool.h>

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

Member Typedef Documentation

◆ task_t

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

Definition at line 115 of file TThreadPool.h.

◆ taskqueue_t

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

Definition at line 116 of file TThreadPool.h.

◆ threads_array_t

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

Definition at line 117 of file TThreadPool.h.

Constructor & Destructor Documentation

◆ TThreadPool()

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

Definition at line 120 of file TThreadPool.h.

◆ ~TThreadPool()

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

Definition at line 144 of file TThreadPool.h.

Member Function Documentation

◆ AddThread()

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

Definition at line 159 of file TThreadPool.h.

◆ DbgLog()

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

Definition at line 326 of file TThreadPool.h.

◆ Drain()

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

Definition at line 209 of file TThreadPool.h.

◆ Executor()

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

Definition at line 246 of file TThreadPool.h.

◆ IdleThreads()

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

Definition at line 224 of file TThreadPool.h.

◆ IsThreadActive()

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

Definition at line 321 of file TThreadPool.h.

◆ JoinHelper()

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

Definition at line 311 of file TThreadPool.h.

◆ Monitor()

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

Definition at line 229 of file TThreadPool.h.

◆ PushTask()

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

Definition at line 167 of file TThreadPool.h.

◆ Stop()

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

Definition at line 182 of file TThreadPool.h.

◆ SuccessfulTasks()

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

Definition at line 220 of file TThreadPool.h.

◆ TasksCount()

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

Definition at line 216 of file TThreadPool.h.

Member Data Documentation

◆ fAllTasksDone

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

Definition at line 339 of file TThreadPool.h.

◆ fDbgOutputMutex

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

Definition at line 347 of file TThreadPool.h.

◆ fIdleThreads

template<class aTask, class aParam>
size_t TThreadPool< aTask, aParam >::fIdleThreads
private

Definition at line 346 of file TThreadPool.h.

◆ fMutex

template<class aTask, class aParam>
TMutex TThreadPool< aTask, aParam >::fMutex
private

Definition at line 335 of file TThreadPool.h.

◆ fMutexAllTasksDone

template<class aTask, class aParam>
TMutex TThreadPool< aTask, aParam >::fMutexAllTasksDone
private

Definition at line 338 of file TThreadPool.h.

◆ fSilent

template<class aTask, class aParam>
bool TThreadPool< aTask, aParam >::fSilent
private

Definition at line 348 of file TThreadPool.h.

◆ fStopped

template<class aTask, class aParam>
volatile bool TThreadPool< aTask, aParam >::fStopped
private

Definition at line 343 of file TThreadPool.h.

◆ fSuccessfulTasks

template<class aTask, class aParam>
size_t TThreadPool< aTask, aParam >::fSuccessfulTasks
private

Definition at line 344 of file TThreadPool.h.

◆ fTasks

template<class aTask, class aParam>
taskqueue_t TThreadPool< aTask, aParam >::fTasks
private

Definition at line 334 of file TThreadPool.h.

◆ fTasksCount

template<class aTask, class aParam>
size_t TThreadPool< aTask, aParam >::fTasksCount
private

Definition at line 345 of file TThreadPool.h.

◆ fThreadAvailable

template<class aTask, class aParam>
TCondition* TThreadPool< aTask, aParam >::fThreadAvailable
private

Definition at line 337 of file TThreadPool.h.

◆ fThreadJoinHelper

template<class aTask, class aParam>
TThread* TThreadPool< aTask, aParam >::fThreadJoinHelper
private

Definition at line 341 of file TThreadPool.h.

◆ fThreadMonitor

template<class aTask, class aParam>
TThread* TThreadPool< aTask, aParam >::fThreadMonitor
private

Definition at line 342 of file TThreadPool.h.

◆ fThreadNeeded

template<class aTask, class aParam>
TCondition* TThreadPool< aTask, aParam >::fThreadNeeded
private

Definition at line 336 of file TThreadPool.h.

◆ fThreads

template<class aTask, class aParam>
threads_array_t TThreadPool< aTask, aParam >::fThreads
private

Definition at line 340 of file TThreadPool.h.


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