Thread-safe allocator adaptor. Uses a spin lock on the assumption that contention here is extremely rare.
Declared in <llvm/Support/ThreadSafeAllocator.h>
template<class AllocatorType>
class ThreadSafeAllocator;
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.
| Name |
|---|
Allocate |
applyLocked |