Pigweed
|
#include <synchronized_allocator.h>
Public Member Functions | |
constexpr | SynchronizedAllocator (Allocator &allocator) noexcept |
![]() | |
void * | Allocate (Layout layout) |
template<typename T , int &... ExplicitGuard, typename... Args> | |
T * | New (Args &&... args) |
template<typename T , int &... ExplicitGuard, typename... Args> | |
UniquePtr< T > | MakeUnique (Args &&... args) |
bool | Resize (void *ptr, size_t new_size) |
bool | Resize (void *ptr, Layout layout, size_t new_size) |
void * | Reallocate (void *ptr, Layout new_layout) |
void * | Reallocate (void *ptr, Layout old_layout, size_t new_size) |
allocator::AsPmrAllocator | as_pmr () |
![]() | |
const Capabilities & | capabilities () const |
bool | HasCapability (Capability capability) const |
Returns whether a given capabilityis enabled for this object. | |
void | Deallocate (void *ptr) |
void | Deallocate (void *ptr, Layout layout) |
template<typename T > | |
void | Delete (T *ptr) |
StatusWithSize | GetCapacity () const |
bool | IsEqual (const Deallocator &other) const |
Additional Inherited Members | |
![]() | |
using | Capabilities = allocator::Capabilities |
using | Capability = allocator::Capability |
using | Layout = allocator::Layout |
![]() | |
constexpr | Allocator ()=default |
TODO(b/326509341): Remove when downstream consumers migrate. | |
constexpr | Allocator (const Capabilities &capabilities) |
![]() | |
constexpr | Deallocator ()=default |
TODO(b/326509341): Remove when downstream consumers migrate. | |
constexpr | Deallocator (const Capabilities &capabilities) |
template<typename T > | |
UniquePtr< T > | WrapUnique (T *ptr) |
Wraps an Allocator
with a lock to synchronize access.
Depending on the LockType
, this object may be thread- and/or interrupt- safe. For example, SynchronizedAllocator<pw::sync::Mutex>
is thread-safe, while SynchronizedAllocator<pw::sync::InterruptSpinLock>
is thread- and interrupt-safe.
LockType | The type of the lock used to synchronize allocator access. Must be default-constructible. |