The Gaudi Framework  v30r3 (a5ef0a68)
IOBoundAlgSchedulerSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_IOBOUNDALGSCHEDULERSVC_H
2 #define GAUDIHIVE_IOBOUNDALGSCHEDULERSVC_H
3 
4 #include <functional>
5 #include <thread>
6 
7 // Framework include files
9 #include "GaudiKernel/IAlgTask.h"
10 #include "GaudiKernel/IRunable.h"
11 #include "GaudiKernel/Service.h"
12 
13 // External libs
14 #include "tbb/concurrent_queue.h"
15 
16 //---------------------------------------------------------------------------
17 
25 class IOBoundAlgSchedulerSvc : public extends<Service, IAccelerator>
26 {
27 public:
28  using extends::extends;
29 
31  StatusCode initialize() override;
32 
34  StatusCode finalize() override;
35 
37  StatusCode push( IAlgTask& task ) override;
38 
39 private:
40  // Utils and shortcuts ----------------------------------------------------
41 
43  void activate();
44 
47 
49  bool m_isActive = false;
50 
53 
54  // Actions management -----------------------------------------------------
55 
58  // typedef std::shared_ptr<action> actionPtr;
60  tbb::concurrent_bounded_queue<action> m_actionsQueue;
61 };
62 
63 #endif // GAUDIHIVE_IOBOUNDALGSCHEDULERSVC_H
bool m_isActive
Flag to track if the scheduler is active or not.
std::thread m_thread
The thread in which the activate function runs.
std::function< StatusCode()> action
StatusCode initialize() override
Initialise.
General interface for a wrapper around Gaudi algorithm.
Definition: IAlgTask.h:15
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode deactivate()
Deactivate scheduler.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
void activate()
Activate scheduler.
StatusCode push(IAlgTask &task) override
Add an algorithm to local queue to run on accelerator.
StatusCode finalize() override
Finalise.
Please refer to the full documentation of the methods for more details.
tbb::concurrent_bounded_queue< action > m_actionsQueue
This is done since the copy of the lambda storage is too expensive.
STL class.