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