ATLAS Offline Software
LockedAllocator.icc
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 // $Id$
7 /**
8  * @file AthAllocators/LockedAllocator.icc
9  * @author scott snyder <snyder@bnl.gov>
10  * @date Mar, 2017
11  * @brief A pointer type that holds a lock on an allocator object.
12  */
13 
14 
15 namespace SG {
16 
17 
18 /**
19  * @brief Constructor.
20  * @param alloc The allocator object to which we're pointing.
21  * @param mutex The mutex to lock.
22  */
23 inline
24 LockedAllocator::LockedAllocator (ArenaAllocatorBase* alloc, std::mutex& mutex)
25  : m_alloc (alloc),
26  m_lock (mutex)
27 {
28 }
29 
30 
31 /**
32  * @brief Dereference the pointer.
33  */
34 inline
35 ArenaAllocatorBase& LockedAllocator::operator*()
36 {
37  return *m_alloc;
38 }
39 
40 
41 /**
42  * @brief Dereference the pointer.
43  */
44 inline
45 ArenaAllocatorBase* LockedAllocator::operator->()
46 {
47  return m_alloc;
48 }
49 
50 
51 /**
52  * @brief Return the underlying pointer.
53  */
54 inline
55 ArenaAllocatorBase* LockedAllocator::get()
56 {
57  return m_alloc;
58 }
59 
60 
61 /**
62  * @brief Return the underlying pointer.
63  */
64 inline
65 const ArenaAllocatorBase* LockedAllocator::get() const
66 {
67  return m_alloc;
68 }
69 
70 
71 } // namespace SG
72 
73