The Gaudi Framework  master (37c0b60a)
ThreadLocalContext.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-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 \***********************************************************************************/
13 
14 #include <Rtypes.h>
15 #include <ThreadLocalStorage.h>
16 
17 namespace {
18  // MacOS X's clang doesn't provide thread_local. So we need to use ROOT's
19  // thread-local implementation to operate on this platform.
20  EventContext& s_curCtx() {
21  TTHREAD_TLS_DECL( EventContext, localContext );
22  return localContext;
23  }
24 } // namespace
25 
26 namespace Gaudi {
27  namespace Hive {
28  ContextIdType currentContextId() { return s_curCtx().slot(); }
29  ContextIdType currentContextEvt() { return s_curCtx().evt(); }
30  const EventContext& currentContext() { return s_curCtx(); }
31 
32  void setCurrentContextEvt( long int evtN ) { s_curCtx().setEvt( evtN ); }
33  void setCurrentContextId( ContextIdType newId ) { s_curCtx().setSlot( newId ); }
34 
35  // FIXME: do we need this method?
36  void setCurrentContextId( ContextIdType newId, long int evtN ) { s_curCtx().set( evtN, newId ); }
37 
38  // FIXME: do we need this method?
39  void setCurrentContextId( const EventContext* ctx ) { s_curCtx() = *ctx; }
40 
41  void setCurrentContext( const EventContext* ctx ) { s_curCtx() = *ctx; }
42 
43  void setCurrentContext( const EventContext& ctx ) { s_curCtx() = ctx; }
44  } // namespace Hive
45 } // namespace Gaudi
Gaudi::Hive::setCurrentContext
GAUDI_API void setCurrentContext(const EventContext *ctx)
Definition: ThreadLocalContext.cpp:41
Gaudi::Hive::currentContext
GAUDI_API const EventContext & currentContext()
Definition: ThreadLocalContext.cpp:30
Gaudi::Hive::currentContextEvt
GAUDI_API ContextIdType currentContextEvt()
Definition: ThreadLocalContext.cpp:29
Gaudi::Hive::setCurrentContextId
GAUDI_API void setCurrentContextId(ContextIdType newId)
Used by the framework to change the value of the current context id.
Definition: ThreadLocalContext.cpp:33
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
ThreadLocalContext.h
EventContext.h
EventContext
Definition: EventContext.h:34
Gaudi::Hive::currentContextId
GAUDI_API ContextIdType currentContextId()
Return the current context id.
Definition: ThreadLocalContext.cpp:28
std::size_t
Gaudi::Hive::setCurrentContextEvt
GAUDI_API void setCurrentContextEvt(long int evtN)
Definition: ThreadLocalContext.cpp:32