The Gaudi Framework  master (37c0b60a)
AsynchronousAlgorithm.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 2023-2024 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 #pragma once
12 // ============================================================================
13 // Include files
14 // ============================================================================
15 // Gaudi
16 #include <Gaudi/Algorithm.h>
18 
19 // Others
20 #include <boost/fiber/all.hpp>
21 #include <chrono>
22 
23 namespace Gaudi {
35  public:
37  StatusCode sysInitialize() override;
38  StatusCode sysExecute( const EventContext& ctx ) override;
39 
41  virtual StatusCode restoreAfterSuspend() const;
42 
44  StatusCode yield() const;
45 
47  template <typename Clock, typename Duration>
49  boost::this_fiber::sleep_until( sleep_time );
50  return restoreAfterSuspend();
51  }
52 
54  template <typename Rep, typename Period>
56  boost::this_fiber::sleep_for( dur );
57  return restoreAfterSuspend();
58  }
59 
60  private:
62  boost::fibers::fiber_specific_ptr<std::size_t> s_currentSlot{};
63  };
64 } // namespace Gaudi
std::chrono::duration
Gaudi::AsynchronousAlgorithm::sleep_until
StatusCode sleep_until(std::chrono::time_point< Clock, Duration > const &sleep_time) const
Forwards to boost::this_fiber::sleep_until.
Definition: AsynchronousAlgorithm.h:48
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
StatusCode
Definition: StatusCode.h:65
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:90
std::chrono::time_point
Gaudi::AsynchronousAlgorithm
Base class for asynchronous algorithms.
Definition: AsynchronousAlgorithm.h:34
Algorithm.h
IHiveWhiteBoard.h
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
EventContext
Definition: EventContext.h:34
Gaudi::Algorithm::Algorithm
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition: Algorithm.h:101
Gaudi::AsynchronousAlgorithm::sleep_for
StatusCode sleep_for(std::chrono::duration< Rep, Period > const &dur) const
Forwards to boost::this_fiber::sleep_for.
Definition: AsynchronousAlgorithm.h:55
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81