ATLAS Offline Software
Loading...
Searching...
No Matches
AthAsynchronousAlgorithm.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2025 CERN for the benefit of the ATLAS collaboration
3*/
4// AthAsynchronousAlgorithm.cxx
5// Implementation file for class AthAsynchronousAlgorithm
6// Author: Beojan Stanislaus
7
10
11StatusCode AthAsynchronousAlgorithm::sysExecute(const EventContext& ctx) {
12 ATH_MSG_VERBOSE("Starting sysExecute for AthAsynchronousAlgorithm on slot "
13 << ctx.slot());
14 if (m_currentCtx.get() == nullptr) {
15 // const_cast because fiber_specific_ptr doesn't support const pointers
16 // The const is never actually violated
17 EventContext* ctx_temp ATLAS_THREAD_SAFE = const_cast<EventContext*>(&ctx);
18 m_currentCtx.reset(ctx_temp);
19 } else if (m_currentCtx->evt() != ctx.evt() ||
20 m_currentCtx->slot() != ctx.slot()) {
21 ATH_MSG_ERROR("m_currentCtx is set to "
22 << m_currentCtx->evt() << " (slot " << m_currentCtx->slot()
23 << ") but incorrect. It should be " << ctx.evt() << "(slot "
24 << ctx.slot() << ")");
25 return StatusCode::FAILURE;
26 }
27 return Gaudi::AsynchronousAlgorithm::sysExecute(ctx);
28}
29
31 auto* currentCtx = m_currentCtx.get();
32 ATH_MSG_DEBUG("Setting current context to " << (void*)currentCtx);
33 Gaudi::Hive::setCurrentContext(currentCtx);
34 return StatusCode::SUCCESS;
35}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
Define macros for attributes used to control the static checker.
virtual StatusCode restoreAfterSuspend() const override
Restore after suspend.
StatusCode sysExecute(const EventContext &ctx) override
Execute an algorithm.
boost::fibers::fiber_specific_ptr< EventContext > m_currentCtx ATLAS_THREAD_SAFE
Pointer to current context.