ATLAS Offline Software
Public Member Functions | Private Types | Private Attributes | List of all members
Athena::RCUSvc Class Reference

Service to allow cleaning up RCU objects at the EndEvent. More...

#include <RCUSvc.h>

Inheritance diagram for Athena::RCUSvc:
Collaboration diagram for Athena::RCUSvc:

Public Member Functions

 RCUSvc (const std::string &name, ISvcLocator *svc)
 Standard Gaudi constructor. More...
 
virtual StatusCode initialize () override
 Standard Gaudi initialize method. More...
 
virtual size_t getNumSlots () const override
 Return the current number of event slots. More...
 
virtual void add (IRCUObject *obj) override
 Add a new RCU object to the set being managed. More...
 
virtual StatusCode remove (IRCUObject *obj) override
 Remove an RCU object to the set being managed. More...
 
virtual void handle (const Incident &inc) override
 Gaudi incident handler. More...
 

Private Types

typedef std::unordered_set< IRCUObject * > set_t
 Set of managed objects. More...
 
typedef std::lock_guard< std::recursive_mutex > lock_t
 

Private Attributes

set_t m_objs
 
ServiceHandle< IInterface > m_hiveWhiteBoardSvc
 The hive WB service. Used to get the current number of slots. More...
 
ServiceHandle< IIncidentSvc > m_incidentSvc
 Gaudi incident service. More...
 
std::recursive_mutex m_mutex
 Mutex protecting access to m_objs. More...
 

Detailed Description

Service to allow cleaning up RCU objects at the EndEvent.

For a summary of RCU usage, see AthenaKernel/RCUObject.h. This service keeps a registry of RCU objects. At EndEvent, it declares them quiescent for the current event slot.

Definition at line 39 of file RCUSvc.h.

Member Typedef Documentation

◆ lock_t

typedef std::lock_guard<std::recursive_mutex> Athena::RCUSvc::lock_t
private

Definition at line 102 of file RCUSvc.h.

◆ set_t

typedef std::unordered_set<IRCUObject*> Athena::RCUSvc::set_t
private

Set of managed objects.

Definition at line 89 of file RCUSvc.h.

Constructor & Destructor Documentation

◆ RCUSvc()

Athena::RCUSvc::RCUSvc ( const std::string &  name,
ISvcLocator *  svc 
)

Standard Gaudi constructor.

Parameters
nameService name.
svcService locator.
nameService name. @svc Service locator.

Definition at line 24 of file RCUSvc.cxx.

25  : extends<AthService, IRCUSvc, IIncidentListener> (name, svc),
26  m_hiveWhiteBoardSvc ("EventDataSvc", name),
27  m_incidentSvc ("IncidentSvc", name)
28 {
29  declareProperty ("HiveWhiteBoardSvc", m_hiveWhiteBoardSvc);
30  declareProperty ("IncidentSvc", m_incidentSvc);
31 }

Member Function Documentation

◆ add()

void Athena::RCUSvc::add ( IRCUObject obj)
overridevirtual

Add a new RCU object to the set being managed.

Parameters
objThe RCU object to add.

Definition at line 67 of file RCUSvc.cxx.

68 {
69  lock_t g (m_mutex);
70  m_objs.insert (obj);
71 }

◆ getNumSlots()

size_t Athena::RCUSvc::getNumSlots ( ) const
overridevirtual

Return the current number of event slots.

Definition at line 51 of file RCUSvc.cxx.

52 {
53  // In non-MT mode, `EventDataSvc' does not have an IHiveWhiteBoard interface.
54  // Fall back to one slot in that case.
55  const SmartIF<IHiveWhiteBoard> wb (m_hiveWhiteBoardSvc.get());
56  if (wb) {
57  return wb->getNumberOfStores();
58  }
59  return 1;
60 }

◆ handle()

void Athena::RCUSvc::handle ( const Incident &  inc)
overridevirtual

Gaudi incident handler.

Declare all managed objects quiescent at EndEvent.

Definition at line 96 of file RCUSvc.cxx.

97 {
98  if (inc.type() == IncidentType::EndEvent) {
99  lock_t g (m_mutex);
100  // Be careful --- calling quiescent() below may lead to objects being
101  // removed from the set.
102  std::vector<IRCUObject*> objs (m_objs.begin(), m_objs.end());
103  for (IRCUObject* p : objs) {
104  if (m_objs.find(p) != m_objs.end()) {
105  p->quiescent (inc.context());
106  }
107  }
108  }
109 }

◆ initialize()

StatusCode Athena::RCUSvc::initialize ( )
overridevirtual

Standard Gaudi initialize method.

Definition at line 37 of file RCUSvc.cxx.

38 {
40  ATH_CHECK( m_hiveWhiteBoardSvc.retrieve() );
41  ATH_CHECK( m_incidentSvc.retrieve() );
42 
43  m_incidentSvc->addListener (this, IncidentType::EndEvent);
44  return StatusCode::SUCCESS;
45 }

◆ remove()

StatusCode Athena::RCUSvc::remove ( IRCUObject obj)
overridevirtual

Remove an RCU object to the set being managed.

Parameters
objThe RCU object to remove.

Returns failure if the requested object isn't in the managed set.

Definition at line 80 of file RCUSvc.cxx.

81 {
82  lock_t g (m_mutex);
83  set_t::iterator it = m_objs.find (obj);
84  if (it == m_objs.end())
85  return StatusCode::FAILURE;
86  m_objs.erase (it);
87  return StatusCode::SUCCESS;
88 }

Member Data Documentation

◆ m_hiveWhiteBoardSvc

ServiceHandle<IInterface> Athena::RCUSvc::m_hiveWhiteBoardSvc
private

The hive WB service. Used to get the current number of slots.

Definition at line 93 of file RCUSvc.h.

◆ m_incidentSvc

ServiceHandle<IIncidentSvc> Athena::RCUSvc::m_incidentSvc
private

Gaudi incident service.

Definition at line 96 of file RCUSvc.h.

◆ m_mutex

std::recursive_mutex Athena::RCUSvc::m_mutex
private

Mutex protecting access to m_objs.

Definition at line 101 of file RCUSvc.h.

◆ m_objs

set_t Athena::RCUSvc::m_objs
private

Definition at line 90 of file RCUSvc.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Athena::RCUSvc::lock_t
std::lock_guard< std::recursive_mutex > lock_t
Definition: RCUSvc.h:102
initialize
void initialize()
Definition: run_EoverP.cxx:894
skel.it
it
Definition: skel.GENtoEVGEN.py:396
Athena::RCUSvc::m_mutex
std::recursive_mutex m_mutex
Mutex protecting access to m_objs.
Definition: RCUSvc.h:101
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
Athena::RCUSvc::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Gaudi incident service.
Definition: RCUSvc.h:96
checkFileSG.objs
list objs
Definition: checkFileSG.py:93
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Athena::RCUSvc::m_hiveWhiteBoardSvc
ServiceHandle< IInterface > m_hiveWhiteBoardSvc
The hive WB service. Used to get the current number of slots.
Definition: RCUSvc.h:93
Athena::RCUSvc::m_objs
set_t m_objs
Definition: RCUSvc.h:90
python.PyAthena.obj
obj
Definition: PyAthena.py:132