ATLAS Offline Software
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 
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 }
AthAsynchronousAlgorithm::restoreAfterSuspend
virtual StatusCode restoreAfterSuspend() const override
Restore after suspend.
Definition: AthAsynchronousAlgorithm.cxx:30
AthAsynchronousAlgorithm::ATLAS_THREAD_SAFE
boost::fibers::fiber_specific_ptr< EventContext > m_currentCtx ATLAS_THREAD_SAFE
Pointer to current context.
Definition: AthAsynchronousAlgorithm.h:43
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AthAsynchronousAlgorithm::sysExecute
StatusCode sysExecute(const EventContext &ctx) override
Execute an algorithm.
Definition: AthAsynchronousAlgorithm.cxx:11
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthAsynchronousAlgorithm.h
checker_macros.h
Define macros for attributes used to control the static checker.