LLVM 20.0.0git
|
Thread-safe allocator adaptor. More...
#include "llvm/Support/ThreadSafeAllocator.h"
Public Member Functions | |
auto | Allocate (size_t N) |
auto | Allocate (size_t Size, size_t Align) |
template<typename FnT , typename T = typename llvm::function_traits<FnT>::result_t> | |
T | applyLocked (FnT Fn) |
Thread-safe allocator adaptor.
Uses a spin lock on the assumption that contention here is extremely rare.
TODO: Using a spin lock on every allocation can be quite expensive when contention is high. Since this is mainly used for BumpPtrAllocator and SpecificBumpPtrAllocator, it'd be better to have a specific thread-safe BumpPtrAllocator implementation that only use a fair lock when allocating a new slab but otherwise using atomic and be lock-free.
Definition at line 26 of file ThreadSafeAllocator.h.
|
inline |
Definition at line 38 of file ThreadSafeAllocator.h.
References llvm::ThreadSafeAllocator< AllocatorType >::applyLocked(), and N.
|
inline |
Definition at line 42 of file ThreadSafeAllocator.h.
References llvm::ThreadSafeAllocator< AllocatorType >::applyLocked(), and Size.
|
inline |
Definition at line 50 of file ThreadSafeAllocator.h.
Referenced by llvm::ThreadSafeAllocator< AllocatorType >::Allocate().