LLVM: llvm::ThreadSafeAllocator< AllocatorType > Class Template Reference (original) (raw)
Thread-safe allocator adaptor. More...
#include "[llvm/Support/ThreadSafeAllocator.h](ThreadSafeAllocator%5F8h%5Fsource.html)"
| 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::result_t> | |
| T | applyLocked (FnT Fn) |
template
class llvm::ThreadSafeAllocator< AllocatorType >
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.
◆ Allocate() [1/2]
template
◆ Allocate() [2/2]
template
◆ applyLocked()
template
template<typename FnT, typename T = typename llvm::function_traits::result_t>
The documentation for this class was generated from the following file:
- include/llvm/Support/ThreadSafeAllocator.h