diff options
author | lloyd <[email protected]> | 2008-09-29 02:25:45 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-29 02:25:45 +0000 |
commit | bd27a130b13667feb26f3157d67d21f8ddb5986e (patch) | |
tree | b01a547f8faf911632a90701079bd1c4f41385d6 /src/secalloc | |
parent | 45bde591db0feeb274e137aa021495f823409fd4 (diff) |
Pass a Mutex* as an argument to Pooling_Allocator instead of it grabbing
one via a reference to the global state.
Diffstat (limited to 'src/secalloc')
-rw-r--r-- | src/secalloc/alloc_mmap/mmap_mem.h | 1 | ||||
-rw-r--r-- | src/secalloc/allocators/defalloc.h | 2 | ||||
-rw-r--r-- | src/secalloc/allocators/mem_pool.cpp | 5 | ||||
-rw-r--r-- | src/secalloc/allocators/mem_pool.h | 2 |
4 files changed, 6 insertions, 4 deletions
diff --git a/src/secalloc/alloc_mmap/mmap_mem.h b/src/secalloc/alloc_mmap/mmap_mem.h index a6f68d039..740aa9ec6 100644 --- a/src/secalloc/alloc_mmap/mmap_mem.h +++ b/src/secalloc/alloc_mmap/mmap_mem.h @@ -16,6 +16,7 @@ namespace Botan { class MemoryMapping_Allocator : public Pooling_Allocator { public: + MemoryMapping_Allocator(Mutex* m) : Pooling_Allocator(m) {} std::string type() const { return "mmap"; } private: void* alloc_block(u32bit); diff --git a/src/secalloc/allocators/defalloc.h b/src/secalloc/allocators/defalloc.h index f162f5c71..dc01ee47f 100644 --- a/src/secalloc/allocators/defalloc.h +++ b/src/secalloc/allocators/defalloc.h @@ -28,6 +28,8 @@ class BOTAN_DLL Malloc_Allocator : public Allocator class BOTAN_DLL Locking_Allocator : public Pooling_Allocator { public: + Locking_Allocator(Mutex* m) : Pooling_Allocator(m) {} + std::string type() const { return "locking"; } private: void* alloc_block(u32bit); diff --git a/src/secalloc/allocators/mem_pool.cpp b/src/secalloc/allocators/mem_pool.cpp index 74d09d5df..0a92997bf 100644 --- a/src/secalloc/allocators/mem_pool.cpp +++ b/src/secalloc/allocators/mem_pool.cpp @@ -6,8 +6,8 @@ *************************************************/ #include <botan/mem_pool.h> -#include <botan/libstate.h> #include <botan/util.h> +#include <botan/mem_ops.h> #include <algorithm> #include <exception> @@ -107,9 +107,8 @@ void Pooling_Allocator::Memory_Block::free(void* ptr, u32bit blocks) throw() /************************************************* * Pooling_Allocator Constructor * *************************************************/ -Pooling_Allocator::Pooling_Allocator() +Pooling_Allocator::Pooling_Allocator(Mutex* m) : mutex(m) { - mutex = global_state().get_mutex(); last_used = blocks.begin(); } diff --git a/src/secalloc/allocators/mem_pool.h b/src/secalloc/allocators/mem_pool.h index 3d28034e7..b74e08a8d 100644 --- a/src/secalloc/allocators/mem_pool.h +++ b/src/secalloc/allocators/mem_pool.h @@ -25,7 +25,7 @@ class BOTAN_DLL Pooling_Allocator : public Allocator void destroy(); - Pooling_Allocator(); + Pooling_Allocator(Mutex*); ~Pooling_Allocator(); private: void get_more_core(u32bit); |