Botan
2.1.0
Crypto and TLS for C++11
Main Page
Namespaces
Classes
Files
File List
File Members
src
lib
utils
locking_allocator
locking_allocator.h
Go to the documentation of this file.
1
/*
2
* Mlock Allocator
3
* (C) 2012 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_MLOCK_ALLOCATOR_H__
9
#define BOTAN_MLOCK_ALLOCATOR_H__
10
11
#include <botan/types.h>
12
#include <vector>
13
#include <botan/mutex.h>
14
15
namespace
Botan
{
16
17
class
BOTAN_DLL
mlock_allocator
18
{
19
public
:
20
static
mlock_allocator
& instance();
21
22
void
* allocate(
size_t
num_elems,
size_t
elem_size);
23
24
bool
deallocate(
void
* p,
size_t
num_elems,
size_t
elem_size);
25
26
mlock_allocator
(
const
mlock_allocator
&) =
delete
;
27
28
mlock_allocator
& operator=(
const
mlock_allocator
&) =
delete
;
29
30
private
:
31
mlock_allocator
();
32
33
~
mlock_allocator
();
34
35
mutex_type m_mutex;
36
std::vector<std::pair<size_t, size_t>> m_freelist;
37
uint8_t* m_pool =
nullptr
;
38
size_t
m_poolsize = 0;
39
};
40
41
}
42
43
#endif
Botan
Definition:
alg_id.cpp:13
Botan::mlock_allocator
Definition:
locking_allocator.h:17
Generated on Fri Aug 4 2017 19:29:39 for Botan by
1.8.9.1