1 #ifndef GAUDIHIVE_THREADPOOLSVC_H 2 #define GAUDIHIVE_THREADPOOLSVC_H 9 #include "boost/thread.hpp" 10 #include "tbb/spin_mutex.h" 11 #include "tbb/task_scheduler_init.h" 12 #define TBB_PREVIEW_GLOBAL_CONTROL 1 13 #include "tbb/global_control.h" StatusCode finalize() override final
Finalise.
ThreadPoolSvc(const std::string &name, ISvcLocator *svc)
Constructor.
std::unique_ptr< tbb::global_control > m_tbbgc
TBB global control parameter.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
StatusCode terminatePool() override final
Terminate the thread pool and launch thread termination tasks.
virtual void initThisThread() override
virtual bool isInit() const
int m_threadPoolSize
Size of the thread pool allocated.
const std::string & name() const override
Retrieve name of the service.
bool m_init
Was the thread pool initialized?
This class is used for returning status codes from appropriate routines.
StatusCode initialize() override final
Initialise.
std::unique_ptr< boost::barrier > m_barrier
Barrier used to synchronization thread init tasks.
tbb::spin_mutex m_initMutex
Mutex used to protect the initPool and terminatePool methods.
Base class used to extend a class implementing other interfaces.
A service which initializes a TBB thread pool.
std::unique_ptr< tbb::task_scheduler_init > m_tbbSchedInit
TBB task scheduler initializer.
StatusCode initPool(const int &poolSize) override final
Initialize the thread pool and launch the ThreadInitTasks.
ToolHandleArray< IThreadInitTool > m_threadInitTools
Handle array of thread init tools.
int poolSize() const override final
StatusCode launchTasks(bool finalize=false)
Launch tasks to execute the ThreadInitTools.