20 struct alignas(2 * sizeof(Node*))
PTag
25 struct alignas(2 * sizeof(Node*))
Node
47 std::memory_order_relaxed))
62 std::memory_order_relaxed))
75 for (
size_t i = 0;
i + 1 <
mSize;
i++)
86 template <
typename...
Args>
93 std::construct_at(&
node->data, std::forward<Args>(
args)...);
General Purpose Allocator (GPA) interface.
Definition Allocator.hpp:24
Atomic, bounded object pool of fixed allocation sizes. Being a sibling to AtomicStack - key differenc...
Definition AtomicPool.hpp:18
Atomic< PTag > mHead
Definition AtomicPool.hpp:34
Node * mNodes
Definition AtomicPool.hpp:32
ScopedArena mArena
Definition AtomicPool.hpp:35
void Destruct(T *ptr)
Destructs the object pointed to by ptr and returns it to the pool.
Definition AtomicPool.hpp:99
~AtomicPool()
Definition AtomicPool.hpp:138
size_t mSize
Definition AtomicPool.hpp:33
T * At(size_t index)
Returns the pointer at the given index in the pool.
Definition AtomicPool.hpp:123
size_t Index(T *ptr) const
Returns the index of the given pointer in the pool.
Definition AtomicPool.hpp:114
T * Construct(Args &&... args)
Constructs an object of type T in the pool with the given arguments.
Definition AtomicPool.hpp:87
void Collect()
Destruct all allocated objects in the pool, collecting garbage.
Definition AtomicPool.hpp:132
AtomicPool(size_t size, Allocator *alloc)
Definition AtomicPool.hpp:71
void DeallocateNode(Node *node)
Definition AtomicPool.hpp:54
Node * AllocateNode()
Definition AtomicPool.hpp:37
Lock-free atomic primitives and implementations of data structures.
Definition Allocator.hpp:5
std::atomic< T > Atomic
Alias of std::atomic<T>.
Definition Atomic.hpp:26
size_type size
Definition Allocator.hpp:19
pointer memory
Definition Allocator.hpp:18
Definition AtomicPool.hpp:26
uintptr_t used
Definition AtomicPool.hpp:28
Node * next
Definition AtomicPool.hpp:27
T data
Definition AtomicPool.hpp:29
Definition AtomicPool.hpp:21
Node * p
Definition AtomicPool.hpp:22
uintptr_t tag
Definition AtomicPool.hpp:23
RAII wrapper for an arena allocated from an Allocator.
Definition Allocator.hpp:44
Arena arena
Definition Allocator.hpp:46