ATLAS Offline Software
Loading...
Searching...
No Matches
DBLock.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 */
11
12
13#ifndef DBLOCK_DBLOCK_H
14#define DBLOCK_DBLOCK_H
15
16
17#include <mutex>
18#include <memory>
19
20
21namespace Athena {
22
23
45class DBLock
46{
47public:
48 DBLock();
49 DBLock(const DBLock&) = default;
50 DBLock(DBLock&&) = default;
51 DBLock& operator=(const DBLock&) = default;
52 DBLock& operator=(DBLock&&) = default;
53 ~DBLock();
54
55
56private:
58 static std::recursive_mutex m_mutex;
59
62 using lock_t = std::unique_lock<std::recursive_mutex>;
63 std::shared_ptr<lock_t> m_lockPtr;
64};
65
66
67} // namespace Athena
68
69
70#endif // not DBLOCK_DBLOCK_H
DBLock & operator=(DBLock &&)=default
std::unique_lock< std::recursive_mutex > lock_t
Shared pointer to underlying lock.
Definition DBLock.h:62
DBLock & operator=(const DBLock &)=default
DBLock(DBLock &&)=default
std::shared_ptr< lock_t > m_lockPtr
Definition DBLock.h:63
~DBLock()
Destructor.
Definition DBLock.cxx:34
static std::recursive_mutex m_mutex
Global mutex to protect database access.
Definition DBLock.h:58
DBLock()
Constructor.
Definition DBLock.cxx:25
DBLock(const DBLock &)=default
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....