#include <bdlma_concurrentallocatoradapter.h>
This class defines an implementation of the bslma::Allocator
protocol that "decorates" (wraps) a concrete bslma::Allocator
to ensure thread-safe access to the decorated allocator.
See bdlma_concurrentallocatoradapter
◆ ConcurrentAllocatorAdapter()
Create a thread-enabled allocator adapter that uses the specified mutex
to synchronize access to the specified basicAllocator
. If basicAllocator
is 0, the currently installed default allocator is used.
◆ ~ConcurrentAllocatorAdapter()
bdlma::ConcurrentAllocatorAdapter::~ConcurrentAllocatorAdapter |
( |
| ) |
|
◆ allocate()
Return a newly-allocated block of memory of (at least) the specified numBytes
. If numBytes
is 0, a null pointer is returned with no other effect. If this allocator cannot return the requested number of bytes, then it will throw a bsl::bad_alloc
exception in an exception-enabled build, or else will abort the program in a non-exception build. Note that the alignment of the address returned conforms to the platform requirement for any object of the numBytes
.
Implements bslma::Allocator.
◆ deallocate()
void bdlma::ConcurrentAllocatorAdapter::deallocate |
( |
void * |
address | ) |
|
|
virtual |
Return the memory at the specified address
back to this allocator. If address
is 0, this function has no effect. The behavior is undefined unless address
was allocated using this allocator and has not since been deallocated.
Implements bslma::Allocator.
The documentation for this class was generated from the following file: