ATLAS Offline Software
Loading...
Searching...
No Matches
LockedAllocator.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/*
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
7// $Id$
14
15
16#include <mutex>
17
18
19#ifndef ATHALLOCATORS_LOCKEDALLOCATOR_H
20#define ATHALLOCATORS_LOCKEDALLOCATOR_H
21
22
23namespace SG {
24
25
27
28
40{
41public:
48
49
54
55
60
61
66
67
71 const ArenaAllocatorBase* get() const;
72
73
74private:
77
79 std::unique_lock<std::mutex> m_lock;
80};
81
82
83} // namespace SG
84
85
87
88
89#endif // not ATHALLOCATORS_LOCKEDALLOCATOR_H
Common base class for arena allocator classes.
ArenaAllocatorBase * m_alloc
The allocator to which we point.
std::unique_lock< std::mutex > m_lock
The lock for the allocator.
ArenaAllocatorBase & operator*()
Dereference the pointer.
ArenaAllocatorBase * get()
Return the underlying pointer.
LockedAllocator(ArenaAllocatorBase *alloc, std::mutex &mutex)
Constructor.
ArenaAllocatorBase * operator->()
Dereference the pointer.
const ArenaAllocatorBase * get() const
Return the underlying pointer.
STL class.
Forward declaration.