ThreadPoolSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_THREADPOOLSVC_H
2 #define GAUDIHIVE_THREADPOOLSVC_H
3 
4 #include "GaudiKernel/Service.h"
8 
9 #include "tbb/spin_mutex.h"
10 #include "tbb/task_scheduler_init.h"
11 #include "boost/thread.hpp"
12 
13 #include <vector>
14 
15 class ThreadPoolSvc: public extends<Service,
16  IThreadPoolSvc> {
17 public:
19  ThreadPoolSvc( const std::string& name, ISvcLocator* svc );
20 
23 
25  virtual StatusCode initialize();
26 
28  virtual StatusCode finalize();
29 
30 
31  virtual StatusCode initPool(const int& poolSize);
32  virtual int poolSize() const {return m_threadPoolSize;}
33  virtual bool isInit() const { return m_init; }
34 
36 
37 private:
38 
39  bool m_init;
41 
43 
44  tbb::spin_mutex m_initMutex;
45 
46  tbb::task_scheduler_init* m_tbbSchedInit;
47 
48  boost::barrier *m_barrier;
49 
50 
51 };
52 
53 #endif
ThreadPoolSvc(const std::string &name, ISvcLocator *svc)
Constructor.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
boost::barrier * m_barrier
Definition: ThreadPoolSvc.h:48
~ThreadPoolSvc()
Destructor.
virtual bool isInit() const
Definition: ThreadPoolSvc.h:33
STL class.
virtual StatusCode initPool(const int &poolSize)
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual int poolSize() const
Definition: ThreadPoolSvc.h:32
tbb::spin_mutex m_initMutex
Definition: ThreadPoolSvc.h:44
tbb::task_scheduler_init * m_tbbSchedInit
Definition: ThreadPoolSvc.h:46
STL class.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
virtual StatusCode initialize()
Initialise.
ToolHandleArray< IThreadInitTool > m_threadInitTools
Definition: ThreadPoolSvc.h:42
virtual std::vector< IThreadInitTool * > getThreadInitTools() const
virtual StatusCode finalize()
Finalise.