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