ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaKernel
AthenaKernel
Timeout.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef ATHENAKERNEL_TIMEOUT_H
6
#define ATHENAKERNEL_TIMEOUT_H 1
7
15
16
17
#include "
AthenaKernel/SlotSpecificObj.h
"
18
#include "GaudiKernel/ThreadLocalContext.h"
19
#include <atomic>
20
21
22
namespace
Athena
{
23
24
// Forward declarations
25
class
TimeoutMaster
;
26
35
class
Timeout
{
37
friend
class
TimeoutMaster
;
38
39
public
:
41
static
Timeout
&
instance
();
42
static
Timeout
&
instance
(
const
EventContext& ctx);
43
45
bool
reached
()
const
{
return
m_state
; }
46
47
Timeout
() :
m_state
(false) {}
48
49
private
:
50
std::atomic<bool>
m_state
;
51
void
set
() {
m_state
=
true
; }
52
void
reset
() {
m_state
=
false
; }
53
54
// Prevent direct instantiation
55
Timeout
(
Timeout
&);
56
Timeout
&
operator=
(
const
Timeout
&);
57
};
58
59
inline
Timeout
&
Timeout::instance
(
const
EventContext& ctx) {
60
static
SG::SlotSpecificObj<Timeout>
instances
ATLAS_THREAD_SAFE
;
61
return
*instances.get (ctx);
62
}
63
64
inline
Timeout
&
Timeout::instance
() {
65
return
instance
(Gaudi::Hive::currentContext());
66
}
67
68
77
class
TimeoutMaster
{
78
protected
:
80
void
setTimeout
(
Timeout
&
instance
) {
instance
.set(); }
81
83
void
resetTimeout
(
Timeout
&
instance
) {
instance
.reset(); }
84
86
TimeoutMaster
() {}
87
TimeoutMaster
(
TimeoutMaster
&);
88
TimeoutMaster
&
operator=
(
const
TimeoutMaster
&);
89
};
90
91
}
// namespace Athena
92
93
#endif
SlotSpecificObj.h
Maintain a set of objects, one per slot.
instance
std::map< std::string, double > instance
Definition
Run_To_Get_Tags.h:8
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition
checker_macros.h:211
Athena::TimeoutMaster
Class to modify timeout flag.
Definition
Timeout.h:77
Athena::TimeoutMaster::TimeoutMaster
TimeoutMaster()
Prevent direct instantiation.
Definition
Timeout.h:86
Athena::TimeoutMaster::TimeoutMaster
TimeoutMaster(TimeoutMaster &)
Athena::TimeoutMaster::resetTimeout
void resetTimeout(Timeout &instance)
Reset timeout.
Definition
Timeout.h:83
Athena::TimeoutMaster::operator=
TimeoutMaster & operator=(const TimeoutMaster &)
Athena::TimeoutMaster::setTimeout
void setTimeout(Timeout &instance)
Set timeout.
Definition
Timeout.h:80
Athena::Timeout
Singleton to access the timeout flag.
Definition
Timeout.h:35
Athena::Timeout::reset
void reset()
Reset timeout flag.
Definition
Timeout.h:52
Athena::Timeout::m_state
std::atomic< bool > m_state
Timeout flag.
Definition
Timeout.h:50
Athena::Timeout::set
void set()
Set timeout flag.
Definition
Timeout.h:51
Athena::Timeout::reached
bool reached() const
Check if the timeout was reached.
Definition
Timeout.h:45
Athena::Timeout::Timeout
Timeout(Timeout &)
Athena::Timeout::Timeout
Timeout()
Definition
Timeout.h:47
Athena::Timeout::TimeoutMaster
friend class TimeoutMaster
Only classes derived from TimeoutMaster can modify timeout flag.
Definition
Timeout.h:37
Athena::Timeout::operator=
Timeout & operator=(const Timeout &)
Athena::Timeout::instance
static Timeout & instance()
Get reference to Timeout singleton.
Definition
Timeout.h:64
SG::SlotSpecificObj
Maintain a set of objects, one per slot.
Definition
AthenaKernel/AthenaKernel/SlotSpecificObj.h:84
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