Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
IDC_WriteHandleBase.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 
9 using namespace EventContainers;
10 
11 
12 
14 
15 //If object has not been filled this will change state to aborted
16 //If object has been filled this should do nothing
18  if(m_atomic==nullptr) return;
19 //Convenience declarations
20  const void* waitstate = reinterpret_cast<const void*>(IdentifiableCacheBase::INVALIDflag);
21  const void* ABORTstate = reinterpret_cast<const void*>(IdentifiableCacheBase::ABORTEDflag);
22 
23 //Running code
24  assert(m_atomic->load() != ABORTstate);
25  //If you have got here the ptr was not set so creation is being aborted
26  //The hash is being set to the aborted flag
27  //I think memory ordering can be relaxed here but to be safe we will use defaults.
28  m_atomic->compare_exchange_strong(waitstate, ABORTstate);
29  //Notify_all to wake up any threads waiting for this hash
30  m_atomic->notify_all();
31 
32  m_atomic = nullptr;
33 }
34 
35 //Can't imagine why this would be used but this may be necessary
37  m_atomic = nullptr;
38 }
39 
IdentifiableCacheBase.h
EventContainers::IdentifiableCacheBase::ABORTEDflag
static constexpr uintptr_t ABORTEDflag
Definition: IdentifiableCacheBase.h:31
EventContainers::IDC_WriteHandleBase::DropLock
void DropLock() noexcept
Definition: IDC_WriteHandleBase.cxx:36
EventContainers
Definition: T_AthenaPoolCreateFuncs.h:33
EventContainers::IDC_WriteHandleBase::m_atomic
std::atomic< const void * > * m_atomic
Definition: IDC_WriteHandleBase.h:15
EventContainers::IDC_WriteHandleBase::ReleaseLock
void ReleaseLock()
Definition: IDC_WriteHandleBase.cxx:17
IDC_WriteHandleBase.h
EventContainers::IDC_WriteHandleBase::~IDC_WriteHandleBase
~IDC_WriteHandleBase()
Definition: IDC_WriteHandleBase.cxx:13
EventContainers::IdentifiableCacheBase::INVALIDflag
static constexpr uintptr_t INVALIDflag
Definition: IdentifiableCacheBase.h:30