The Gaudi Framework  v33r0 (d5ea422b)
IOBoundAlgSchedulerSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIHIVE_IOBOUNDALGSCHEDULERSVC_H
12 #define GAUDIHIVE_IOBOUNDALGSCHEDULERSVC_H
13 
14 #include <functional>
15 #include <thread>
16 
17 // Framework include files
19 #include "GaudiKernel/IAlgTask.h"
20 #include "GaudiKernel/IRunable.h"
21 #include "GaudiKernel/Service.h"
22 
23 // External libs
24 #include "tbb/concurrent_queue.h"
25 
26 //---------------------------------------------------------------------------
27 
35 class IOBoundAlgSchedulerSvc : public extends<Service, IAccelerator> {
36 public:
37  using extends::extends;
38 
40  StatusCode initialize() override;
41 
43  StatusCode finalize() override;
44 
46  StatusCode push( IAlgTask& task ) override;
47 
48 private:
49  // Utils and shortcuts ----------------------------------------------------
50 
52  void activate();
53 
56 
58  bool m_isActive = false;
59 
62 
63  // Actions management -----------------------------------------------------
64 
67  // typedef std::shared_ptr<action> actionPtr;
69  tbb::concurrent_bounded_queue<action> m_actionsQueue;
70 };
71 
72 #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:25
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
StatusCode deactivate()
Deactivate scheduler.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
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.