ATLAS Offline Software
Control
CxxUtils
CxxUtils
LockedPointer.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-2021 CERN for the benefit of the ATLAS collaboration.
4
*/
13
#ifndef CXXUTILS_LOCKEDPOINTER_H
14
#define CXXUTILS_LOCKEDPOINTER_H
15
16
17
#include <mutex>
18
19
20
namespace
CxxUtils
{
21
22
33
template
<
class
T,
class
MUTEX=std::recursive_mutex>
34
class
LockedPointer
35
{
36
public
:
37
LockedPointer
(T&
p
, std::unique_lock<MUTEX>&& lock)
38
:
m_lock
(std::move (lock)),
39
m_p
(
p
)
40
{
41
}
42
43
T*
get
() {
return
&
m_p
; }
44
T*
operator->
() {
return
&
m_p
; }
45
T&
operator*
() {
return
m_p
; }
46
47
private
:
48
std::unique_lock<MUTEX>
m_lock
;
49
T&
m_p
;
50
};
51
52
}
// namespace CxxUtils
53
54
55
#endif // not CXXUTILS_LOCKEDPOINTER_H
CxxUtils::LockedPointer::get
T * get()
Definition:
LockedPointer.h:43
CxxUtils::LockedPointer::LockedPointer
LockedPointer(T &p, std::unique_lock< MUTEX > &&lock)
Definition:
LockedPointer.h:37
CxxUtils::LockedPointer::m_lock
std::unique_lock< MUTEX > m_lock
Definition:
LockedPointer.h:48
CxxUtils::LockedPointer
A pointer together with a movable lock.
Definition:
LockedPointer.h:35
CxxUtils::LockedPointer::operator*
T & operator*()
Definition:
LockedPointer.h:45
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:210
CxxUtils
Definition:
aligned_vector.h:29
CxxUtils::LockedPointer::operator->
T * operator->()
Definition:
LockedPointer.h:44
CxxUtils::LockedPointer::m_p
T & m_p
Definition:
LockedPointer.h:49
Generated on Thu Nov 7 2024 21:20:13 for ATLAS Offline Software by
1.8.18