ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
EventContainers::IDC_WriteHandleBase Class Reference

#include <IDC_WriteHandleBase.h>

Inheritance diagram for EventContainers::IDC_WriteHandleBase:
Collaboration diagram for EventContainers::IDC_WriteHandleBase:

Public Member Functions

void LockOn (std::atomic< const void * > *in) noexcept
 
void DropLock () noexcept
 
void ReleaseLock ()
 
 ~IDC_WriteHandleBase ()
 

Protected Member Functions

 IDC_WriteHandleBase ()
 

Protected Attributes

std::atomic< const void * > * m_atomic
 

Detailed Description

Definition at line 13 of file IDC_WriteHandleBase.h.

Constructor & Destructor Documentation

◆ IDC_WriteHandleBase()

EventContainers::IDC_WriteHandleBase::IDC_WriteHandleBase ( )
inlineprotected

Definition at line 17 of file IDC_WriteHandleBase.h.

17  : m_atomic(nullptr)
18  { }

◆ ~IDC_WriteHandleBase()

IDC_WriteHandleBase::~IDC_WriteHandleBase ( )

Definition at line 13 of file IDC_WriteHandleBase.cxx.

13 { ReleaseLock(); }

Member Function Documentation

◆ DropLock()

void IDC_WriteHandleBase::DropLock ( )
noexcept

Definition at line 36 of file IDC_WriteHandleBase.cxx.

36  {
37  m_atomic = nullptr;
38 }

◆ LockOn()

void EventContainers::IDC_WriteHandleBase::LockOn ( std::atomic< const void * > *  in)
inlinenoexcept

Definition at line 21 of file IDC_WriteHandleBase.h.

21  {
22  m_atomic = in;
23  }

◆ ReleaseLock()

void IDC_WriteHandleBase::ReleaseLock ( )

Definition at line 17 of file IDC_WriteHandleBase.cxx.

17  {
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 }

Member Data Documentation

◆ m_atomic

std::atomic<const void*>* EventContainers::IDC_WriteHandleBase::m_atomic
protected

Definition at line 15 of file IDC_WriteHandleBase.h.


The documentation for this class was generated from the following files:
EventContainers::IdentifiableCacheBase::ABORTEDflag
static constexpr uintptr_t ABORTEDflag
Definition: IdentifiableCacheBase.h:31
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
EventContainers::IdentifiableCacheBase::INVALIDflag
static constexpr uintptr_t INVALIDflag
Definition: IdentifiableCacheBase.h:30