ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaServices
src
RCUSvc.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
11
12
13
#include "
RCUSvc.h
"
14
15
16
namespace
Athena
{
17
18
24
RCUSvc::RCUSvc
(
const
std::string& name, ISvcLocator* svc)
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
}
32
33
37
StatusCode
RCUSvc::initialize
()
38
{
39
ATH_CHECK
( AthService::initialize() );
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
}
46
47
51
size_t
RCUSvc::getNumSlots
()
const
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
}
61
62
67
void
RCUSvc::add
(
IRCUObject
* obj)
68
{
69
lock_t
g (
m_mutex
);
70
m_objs
.insert (obj);
71
}
72
73
80
StatusCode
RCUSvc::remove
(
IRCUObject
* obj)
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
}
89
90
96
void
RCUSvc::handle
(
const
Incident& inc)
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
}
110
111
112
}
// namespace Athena
113
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
RCUSvc.h
Service to allow cleaning up RCU objects at the EndEvent.
AthService
Definition
AthService.h:32
Athena::IRCUObject
Base object class for RCU-style synchronization for Athena.
Definition
RCUObject.h:147
Athena::IRCUSvc
Interface for RCU service.
Definition
IRCUSvc.h:40
Athena::RCUSvc::RCUSvc
RCUSvc(const std::string &name, ISvcLocator *svc)
Standard Gaudi constructor.
Definition
RCUSvc.cxx:24
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::getNumSlots
virtual size_t getNumSlots() const override
Return the current number of event slots.
Definition
RCUSvc.cxx:51
Athena::RCUSvc::initialize
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Definition
RCUSvc.cxx:37
Athena::RCUSvc::m_mutex
std::recursive_mutex m_mutex
Mutex protecting access to m_objs.
Definition
RCUSvc.h:101
Athena::RCUSvc::add
virtual void add(IRCUObject *obj) override
Add a new RCU object to the set being managed.
Definition
RCUSvc.cxx:67
Athena::RCUSvc::m_objs
set_t m_objs
Definition
RCUSvc.h:90
Athena::RCUSvc::remove
virtual StatusCode remove(IRCUObject *obj) override
Remove an RCU object to the set being managed.
Definition
RCUSvc.cxx:80
Athena::RCUSvc::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Gaudi incident service.
Definition
RCUSvc.h:96
Athena::RCUSvc::lock_t
std::lock_guard< std::recursive_mutex > lock_t
Definition
RCUSvc.h:102
Athena::RCUSvc::handle
virtual void handle(const Incident &inc) override
Gaudi incident handler.
Definition
RCUSvc.cxx:96
Athena
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....
Definition
AthDsoUtils.h:10
Generated on
for ATLAS Offline Software by
1.17.0