ATLAS Offline Software
Loading...
Searching...
No Matches
RCUSvc.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2
3/*
4 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5*/
6
13
14
15#ifndef ATHENASERVICES_RCUSVC_H
16#define ATHENASERVICES_RCUSVC_H
17
18
21#include "GaudiKernel/ServiceHandle.h"
22#include "GaudiKernel/IHiveWhiteBoard.h"
23#include "GaudiKernel/IIncidentSvc.h"
24#include "GaudiKernel/IIncidentListener.h"
25#include <unordered_map>
26#include <mutex>
27
28
29namespace Athena {
30
31
39class RCUSvc
40 : public extends<AthService, IRCUSvc, IIncidentListener>
41{
42public:
48 RCUSvc (const std::string& name, ISvcLocator* svc);
49
50
54 virtual StatusCode initialize() override;
55
56
60 virtual size_t getNumSlots() const override;
61
62
67 virtual void add (IRCUObject* obj) override;
68
69
76 virtual StatusCode remove (IRCUObject* obj) override;
77
78
84 virtual void handle (const Incident& inc) override;
85
86
87private:
89 typedef std::unordered_set<IRCUObject*> set_t;
91
94
97
99 // Needs to be recursive since when handle() quiesces objects,
100 // it can lead to calls to remove().
101 std::recursive_mutex m_mutex;
102 typedef std::lock_guard<std::recursive_mutex> lock_t;
103};
104
105
106} // namespace Athena
107
108
109#endif // not ATHENASERVICES_RCUSVC_H
read-copy-update (RCU) style synchronization for Athena.
Base object class for RCU-style synchronization for Athena.
Definition RCUObject.h:147
RCUSvc(const std::string &name, ISvcLocator *svc)
Standard Gaudi constructor.
Definition RCUSvc.cxx:24
ServiceHandle< IInterface > m_hiveWhiteBoardSvc
The hive WB service. Used to get the current number of slots.
Definition RCUSvc.h:93
virtual size_t getNumSlots() const override
Return the current number of event slots.
Definition RCUSvc.cxx:51
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Definition RCUSvc.cxx:37
std::recursive_mutex m_mutex
Mutex protecting access to m_objs.
Definition RCUSvc.h:101
virtual void add(IRCUObject *obj) override
Add a new RCU object to the set being managed.
Definition RCUSvc.cxx:67
set_t m_objs
Definition RCUSvc.h:90
std::unordered_set< IRCUObject * > set_t
Set of managed objects.
Definition RCUSvc.h:89
virtual StatusCode remove(IRCUObject *obj) override
Remove an RCU object to the set being managed.
Definition RCUSvc.cxx:80
ServiceHandle< IIncidentSvc > m_incidentSvc
Gaudi incident service.
Definition RCUSvc.h:96
std::lock_guard< std::recursive_mutex > lock_t
Definition RCUSvc.h:102
virtual void handle(const Incident &inc) override
Gaudi incident handler.
Definition RCUSvc.cxx:96
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....