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.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 2024-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 \***********************************************************************************/
12 
14  setAsynchronous( true );
15  msg() << MSG::DEBUG << "Starting sysInitialize for AsynchronousAlgorithm" << endmsg;
17 }
18 
20  msg() << MSG::DEBUG << "Starting sysExecute for AsynchronousAlgorithm on slot " << ctx.slot()
21  << "with s_currentSlot = " << fmt::to_string( fmt::ptr( s_currentSlot.get() ) ) << endmsg;
22  if ( s_currentSlot.get() == nullptr ) {
23  s_currentSlot.reset( new std::size_t( ctx.slot() ) );
24  } else if ( *s_currentSlot != ctx.slot() ) {
25  error() << "Current slot is " << ctx.slot() << " but s_currentSlot exists and is " << *s_currentSlot << endmsg;
26  return StatusCode::FAILURE;
27  }
29 } catch ( const GaudiException& e ) {
30  error() << "EXCEPTION MESSAGE IS: " << e.what() << endmsg;
31  throw;
32 }
33 
35  if ( !whiteboard()->selectStore( *s_currentSlot ).isSuccess() ) {
36  msg() << MSG::ERROR << "Resetting slot from fiber_specific_ptr failed" << endmsg;
37  return StatusCode::FAILURE;
38  }
39  return StatusCode::SUCCESS;
40 }
41 
43  boost::this_fiber::yield();
44  return restoreAfterSuspend();
45 }
MSG::DEBUG
@ DEBUG
Definition: IMessageSvc.h:22
Gaudi::Algorithm::sysExecute
StatusCode sysExecute(const EventContext &ctx) override
The actions to be performed by the algorithm on an event.
Definition: Algorithm.cpp:322
GaudiException
Definition: GaudiException.h:29
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
AsynchronousAlgorithm.h
GPUAvalancheSchedulerSimpleTest.whiteboard
whiteboard
Definition: GPUAvalancheSchedulerSimpleTest.py:65
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
StatusCode
Definition: StatusCode.h:64
Gaudi::Algorithm::sysInitialize
StatusCode sysInitialize() override
Initialization method invoked by the framework.
Definition: Algorithm.cpp:53
Gaudi::AsynchronousAlgorithm::restoreAfterSuspend
virtual StatusCode restoreAfterSuspend() const
Restore after suspend.
Definition: AsynchronousAlgorithm.cpp:34
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:198
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:99
MSG::ERROR
@ ERROR
Definition: IMessageSvc.h:22
Gaudi::AsynchronousAlgorithm::sysExecute
StatusCode sysExecute(const EventContext &ctx) override
Definition: AsynchronousAlgorithm.cpp:19
EventContext
Definition: EventContext.h:34
Gaudi::AsynchronousAlgorithm::sysInitialize
StatusCode sysInitialize() override
Definition: AsynchronousAlgorithm.cpp:13
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:100
Gaudi::AsynchronousAlgorithm::yield
StatusCode yield() const
Forwards to boost::this_fiber::yield.
Definition: AsynchronousAlgorithm.cpp:42
GaudiException::what
const char * what() const override
method from std::exception
Definition: GaudiException.h:108
Gaudi::Algorithm::setAsynchronous
void setAsynchronous(bool value)
Definition: Algorithm.h:378