Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 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 121 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 122 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 123 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 126 of file TThreadPool.h.

◆ ~TThreadPool()

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

Definition at line 150 of file TThreadPool.h.

Member Function Documentation

◆ AddThread()

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

Definition at line 165 of file TThreadPool.h.

◆ DbgLog()

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

Definition at line 332 of file TThreadPool.h.

◆ Drain()

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

Definition at line 215 of file TThreadPool.h.

◆ Executor()

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

Definition at line 252 of file TThreadPool.h.

◆ IdleThreads()

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

Definition at line 230 of file TThreadPool.h.

◆ IsThreadActive()

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

Definition at line 327 of file TThreadPool.h.

◆ JoinHelper()

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

Definition at line 317 of file TThreadPool.h.

◆ Monitor()

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

Definition at line 235 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 173 of file TThreadPool.h.

◆ Stop()

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

Definition at line 188 of file TThreadPool.h.

◆ SuccessfulTasks()

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

Definition at line 226 of file TThreadPool.h.

◆ TasksCount()

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

Definition at line 222 of file TThreadPool.h.

Member Data Documentation

◆ fAllTasksDone

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

Definition at line 345 of file TThreadPool.h.

◆ fDbgOutputMutex

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

Definition at line 353 of file TThreadPool.h.

◆ fIdleThreads

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

Definition at line 352 of file TThreadPool.h.

◆ fMutex

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

Definition at line 341 of file TThreadPool.h.

◆ fMutexAllTasksDone

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

Definition at line 344 of file TThreadPool.h.

◆ fSilent

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

Definition at line 354 of file TThreadPool.h.

◆ fStopped

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

Definition at line 349 of file TThreadPool.h.

◆ fSuccessfulTasks

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

Definition at line 350 of file TThreadPool.h.

◆ fTasks

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

Definition at line 340 of file TThreadPool.h.

◆ fTasksCount

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

Definition at line 351 of file TThreadPool.h.

◆ fThreadAvailable

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

Definition at line 343 of file TThreadPool.h.

◆ fThreadJoinHelper

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

Definition at line 347 of file TThreadPool.h.

◆ fThreadMonitor

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

Definition at line 348 of file TThreadPool.h.

◆ fThreadNeeded

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

Definition at line 342 of file TThreadPool.h.

◆ fThreads

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

Definition at line 346 of file TThreadPool.h.

  • core/thread/inc/TThreadPool.h