template <typename Node, size_t SlotSize>
class LockFreeList
Defined at line 34 of file ../../zircon/kernel/lib/fbl/include/fbl/gparena.h
A simple lock-free list for use by GPArena.
Rather than by address, the list refers to nodes by their 1-based index in an array of
|SlotSize|-byte slots that starts at the address passed to Init, with index 0 meaning "no node".
This makes the head of the list, which pairs the index of the first node with a generation
count, small enough to fit in 64 bits, so that it can be updated with 8-byte atomic operations.
Unlike 16-byte atomic operations, these are lock-free on all supported architectures.
|Node| must have a naturally aligned uint32_t |next| member, which holds the index of the next
node in the list while the node is in the list, and which the list accesses atomically.
Public Members
static const uint32_t kGenerationBits
static const uint32_t kIndexBits
static const size_t kMaxNodes
Public Methods
void Init (uintptr_t base)
Set the address of the first slot. Must be called before any node is pushed.
Defined at line 46 of file ../../zircon/kernel/lib/fbl/include/fbl/gparena.h
void Push (Node * node)
Push |node| onto the list.
Defined at line 49 of file ../../zircon/kernel/lib/fbl/include/fbl/gparena.h
Node * Pop ()
Pop a node from the list. Returns nullptr if empty.
Defined at line 68 of file ../../zircon/kernel/lib/fbl/include/fbl/gparena.h