ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthContainers
AthContainers
tools
threading.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
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4
*/
15
16
17
#ifndef ATHCONTAINERS_THREADING_H
18
#define ATHCONTAINERS_THREADING_H
19
20
21
#ifdef ATHCONTAINERS_NO_THREADS
22
23
24
namespace
AthContainers_detail
{
25
26
30
class
mutex {};
31
32
36
class
recursive_mutex {};
37
38
42
template
<
class
LOCKABLE>
43
class
lock_guard
44
{
45
public
:
46
lock_guard() {}
47
lock_guard(LOCKABLE&) {}
48
};
49
50
52
inline
void
fence_acq_rel
() {}
53
inline
void
fence_seq_cst
() {}
54
55
57
template
<
class
T>
58
class
atomic
59
{
60
public
:
61
atomic() : m_val() {}
62
operator
T
()
const
{
return
m_val; }
63
atomic&
operator=
(
const
T& val) { m_val =
val
;
return
*
this
; }
64
65
private
:
66
T
m_val;
67
};
68
69
70
}
// namespace AthContainers_detail
71
72
73
#else
// not ATHCONTAINERS_NO_THREADS
74
75
//the shared_mutex include generates annoying unused_variable warnings during compilations... silence this in athanalysisbase
76
#ifdef XAOD_ANALYSIS
77
#ifndef BOOST_SYSTEM_NO_DEPRECATED
78
#define BOOST_SYSTEM_NO_DEPRECATED 1
79
#endif
80
#endif
81
82
83
#include <atomic>
84
#include <mutex>
85
#include <thread>
86
87
88
namespace
AthContainers_detail
{
89
90
91
using
std::mutex;
92
using
std::recursive_mutex;
93
using
std::lock_guard;
94
using
std::thread;
95
using
std::atomic;
96
97
101
void
fence_acq_rel
();
102
103
107
void
fence_seq_cst
();
108
109
110
}
// namespace AthContainers_detail
111
112
113
#endif
// not ATHCONTAINERS_NO_THREADS
114
115
116
117
namespace
AthContainers_detail
{
118
119
126
template
<
typename
LOCKABLE>
127
class
strict_shared_lock
128
{
129
public
:
131
typedef
LOCKABLE
lockable_type
;
132
133
138
explicit
strict_shared_lock
(
lockable_type
& obj);
139
140
145
explicit
strict_shared_lock
(
const
lockable_type
& obj);
146
147
151
~strict_shared_lock
();
152
153
154
private
:
155
// Disallow these.
156
strict_shared_lock
();
157
strict_shared_lock
(
strict_shared_lock
const
&);
158
strict_shared_lock
&
operator=
(
strict_shared_lock
const
&);
159
160
161
private
:
163
lockable_type
&
m_obj
;
164
};
165
166
175
template
<
class
LOCKABLE>
176
class
upgrading_lock
177
{
178
public
:
180
typedef
LOCKABLE
lockable_type
;
181
182
187
explicit
upgrading_lock
(
lockable_type
& obj);
188
189
193
~upgrading_lock
();
194
195
199
void
upgrade
();
200
201
202
private
:
203
// Disallow these.
204
upgrading_lock
();
205
upgrading_lock
(
upgrading_lock
const
&);
206
upgrading_lock
&
operator=
(
upgrading_lock
const
&);
207
208
209
private
:
211
lockable_type
&
m_obj
;
212
214
bool
m_exclusive
;
215
};
216
217
218
}
// namespace AthContainers_detail
219
220
221
#include "
AthContainers/tools/threading.icc
"
222
223
224
#endif
// not ATHCONTAINERS_THREADING_H
operator=
ElementLink & operator=(const ElementLink &)=default
AthContainers_detail::strict_shared_lock::m_obj
lockable_type & m_obj
The lock being held.
Definition
threading.h:163
AthContainers_detail::strict_shared_lock::strict_shared_lock
strict_shared_lock(strict_shared_lock const &)
AthContainers_detail::strict_shared_lock::strict_shared_lock
strict_shared_lock(lockable_type &obj)
Take out a shared lock on obj and remember it.
AthContainers_detail::strict_shared_lock::strict_shared_lock
strict_shared_lock()
AthContainers_detail::strict_shared_lock::strict_shared_lock
strict_shared_lock(const lockable_type &obj)
Take out a shared lock on obj and remember it.
AthContainers_detail::strict_shared_lock::~strict_shared_lock
~strict_shared_lock()
Release the held lock.
AthContainers_detail::strict_shared_lock::operator=
strict_shared_lock & operator=(strict_shared_lock const &)
AthContainers_detail::strict_shared_lock::lockable_type
LOCKABLE lockable_type
The underlying object type.
Definition
threading.h:131
AthContainers_detail::upgrading_lock::upgrading_lock
upgrading_lock(upgrading_lock const &)
AthContainers_detail::upgrading_lock::~upgrading_lock
~upgrading_lock()
Release the held lock.
AthContainers_detail::upgrading_lock::operator=
upgrading_lock & operator=(upgrading_lock const &)
AthContainers_detail::upgrading_lock::upgrading_lock
upgrading_lock()
AthContainers_detail::upgrading_lock::lockable_type
LOCKABLE lockable_type
The underlying object type.
Definition
threading.h:180
AthContainers_detail::upgrading_lock< upgrade_mutex_t >::m_exclusive
bool m_exclusive
Definition
threading.h:214
AthContainers_detail::upgrading_lock::upgrade
void upgrade()
Convert the lock from upgrade to exclusive.
AthContainers_detail::upgrading_lock< upgrade_mutex_t >::m_obj
lockable_type & m_obj
Definition
threading.h:211
AthContainers_detail::upgrading_lock::upgrading_lock
upgrading_lock(lockable_type &obj)
Take out an upgrade lock on obj and remember it.
AthContainers_detail
Definition
concurrent_vector.h:54
AthContainers_detail::fence_seq_cst
void fence_seq_cst()
A sequentially-consistent fence.
AthContainers_detail::fence_acq_rel
void fence_acq_rel()
An acquire/release fence.
Pythia8_RapidityOrderMPI.val
val
Definition
Pythia8_RapidityOrderMPI.py:14
TSU::T
unsigned long long T
Definition
L1TopoDataTypes.h:36
threading.icc
Generated on
for ATLAS Offline Software by
1.17.0