Go to the documentation of this file.
11 #ifndef GAUDIHIVE_THREADPOOLSVC_H
12 #define GAUDIHIVE_THREADPOOLSVC_H
19 #include <boost/thread/barrier.hpp>
21 #include <tbb/global_control.h>
22 #include <tbb/spin_mutex.h>
23 #include <tbb/task_arena.h>
tbb::spin_mutex m_initMutex
Mutex used to protect the initPool and terminatePool methods.
ThreadPoolSvc(const std::string &name, ISvcLocator *svc)
Constructor.
int poolSize() const override final
std::atomic< int > m_threadInitCount
Counter for all threads that are initialised.
StatusCode launchTasks(bool finalize=false)
Launch tasks to execute the ThreadInitTools.
StatusCode initialize() override final
Initialise.
virtual bool isInit() const
std::unique_ptr< tbb::global_control > m_tbbgc
TBB global control parameter.
ToolHandleArray< IThreadInitTool > m_threadInitTools
Handle array of thread init tools.
bool m_init
Was the thread pool initialized?
StatusCode initPool(const int &poolSize, const int &maxParallelismExtra) override final
Initialize the thread pool and launch the ThreadInitTasks.
const std::string & name() const override
Retrieve name of the service
int m_threadPoolSize
Size of the thread pool allocated.
tbb::task_arena * getArena()
StatusCode finalize() override final
Finalise.
std::unique_ptr< boost::barrier > m_barrier
Barrier used to synchronization thread init tasks.
Base class used to extend a class implementing other interfaces.
tbb::task_arena m_arena
TBB task arena to run all algorithms.
StatusCode terminatePool() override final
Terminate the thread pool and launch thread termination tasks.
virtual void initThisThread() override
A service which initializes a TBB thread pool.