ATLAS Offline Software
RCUObject.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
12 #include "AthenaKernel/RCUObject.h"
13 #include "AthenaKernel/IRCUSvc.h"
14 #include <cstdlib>
15 
16 
17 namespace Athena {
18 
19 
27  : m_svc (&svc),
28  m_grace (svc.getNumSlots()),
29  m_oldGrace (svc.getNumSlots()),
30  m_nold(0),
31  m_dirty(false)
32 {
33  m_svc->add (this);
34 }
35 
36 
43 IRCUObject::IRCUObject (size_t nslots)
44  : m_svc (nullptr),
45  m_grace (nslots),
46  m_oldGrace (nslots),
47  m_nold(0),
48  m_dirty(false)
49 {
50 }
51 
52 
59 {
60  if (m_svc && m_svc->remove (this).isFailure())
61  std::abort();
62 }
63 
64 
71  : m_svc (other.m_svc),
72  m_grace (std::move (other.m_grace)),
73  m_oldGrace (std::move (other.m_oldGrace)),
74  m_nold (other.m_nold),
75  m_dirty (false)
76 {
77  other.m_nold = 0;
78  if (other.m_dirty) {
79  m_dirty = true;
80  }
81  other.m_dirty = false;
82  if (m_svc) {
83  if (m_svc->remove (&other).isFailure()) {
84  std::abort();
85  }
86  other.m_svc = nullptr;
87  m_svc->add (this);
88  }
89 }
90 
91 
92 } // namespace Athena
Athena::IRCUObject::m_dirty
std::atomic< bool > m_dirty
True if there are any objects pending deletion.
Definition: RCUObject.h:310
RCUObject.h
read-copy-update (RCU) style synchronization for Athena.
Athena::IRCUObject::IRCUObject
IRCUObject(IRCUSvc &svc)
Constructor, with RCUSvc.
Definition: RCUObject.cxx:26
Athena::IRCUObject::m_svc
IRCUSvc * m_svc
The service with which we're registered, or null.
Definition: RCUObject.h:296
Athena::IRCUSvc::add
virtual void add(IRCUObject *obj)=0
Add a new RCU object to the set being managed.
Athena::IRCUObject::~IRCUObject
virtual ~IRCUObject()
Destructor.
Definition: RCUObject.cxx:58
IRCUSvc.h
read-copy-update (RCU) style synchronization for Athena.
Athena
Some weak symbol referencing magic...
Definition: AthLegacySequence.h:21
Athena::IRCUSvc
Interface for RCU service.
Definition: IRCUSvc.h:40
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
Athena::IRCUSvc::remove
virtual StatusCode remove(IRCUObject *obj)=0
Remove an object from the service.
Athena::IRCUObject
Base object class for RCU-style synchronization for Athena.
Definition: RCUObject.h:146
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16