The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
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;
27 }
28 return Gaudi::Algorithm::sysExecute( ctx );
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;
38 }
40}
41
43 boost::this_fiber::yield();
44 return restoreAfterSuspend();
45}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
This class represents an entry point to all the event specific data.
StatusCode sysExecute(const EventContext &ctx) override
The actions to be performed by the algorithm on an event.
void setAsynchronous(bool value)
Definition Algorithm.h:378
SmartIF< IHiveWhiteBoard > & whiteboard() const
StatusCode sysInitialize() override
Initialization method invoked by the framework.
Definition Algorithm.cpp:53
StatusCode sysExecute(const EventContext &ctx) override
virtual StatusCode restoreAfterSuspend() const
Restore after suspend.
StatusCode yield() const
Forwards to boost::this_fiber::yield.
boost::fibers::fiber_specific_ptr< std::size_t > s_currentSlot
Contains current slot.
Define general base for Gaudi exception.
const char * what() const override
method from std::exception
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
constexpr static const auto SUCCESS
Definition StatusCode.h:99
constexpr static const auto FAILURE
Definition StatusCode.h:100
@ DEBUG
Definition IMessageSvc.h:22
@ ERROR
Definition IMessageSvc.h:22