Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (d98a2936)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
AsynchronousAlgorithm.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 2023-2025 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 <Gaudi/Algorithm.h>
15 #include <boost/fiber/all.hpp>
16 #include <chrono>
17 
18 namespace Gaudi {
30  public:
32  StatusCode sysInitialize() override;
33  StatusCode sysExecute( const EventContext& ctx ) override;
34 
36  virtual StatusCode restoreAfterSuspend() const;
37 
39  StatusCode yield() const;
40 
42  template <typename Clock, typename Duration>
43  StatusCode sleep_until( std::chrono::time_point<Clock, Duration> const& sleep_time ) const {
44  boost::this_fiber::sleep_until( sleep_time );
45  return restoreAfterSuspend();
46  }
47 
49  template <typename Rep, typename Period>
50  StatusCode sleep_for( std::chrono::duration<Rep, Period> const& dur ) const {
51  boost::this_fiber::sleep_for( dur );
52  return restoreAfterSuspend();
53  }
54 
55  private:
57  boost::fibers::fiber_specific_ptr<std::size_t> s_currentSlot{};
58  };
59 } // namespace Gaudi
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:43
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
StatusCode
Definition: StatusCode.h:64
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:87
Gaudi::AsynchronousAlgorithm
Base class for asynchronous algorithms.
Definition: AsynchronousAlgorithm.h:29
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:98
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:50
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:49