Epoch-based garbage collection.
Concurrent collections are built using atomic pointers. This module provides
is just a shared atomic pointer to a heap-allocated object. Loading an
Atomic yields a
Ptr, which is an epoch-protected pointer through which the loaded object can be safely
Atomic can be loaded, the current thread must be pinned. By pinning a thread we
declare that any object that gets removed from now on must not be destructed just yet. Garbage
collection of newly removed objects is suspended until the thread gets unpinned.
Objects that get removed from concurrent collections must be stashed away until all currently
pinned threads get unpinned. Such objects can be stored into a
Garbage, where they are kept
until the right time for their destruction comes.
There is a global shared instance of
Garbage, which can only deallocate memory. It cannot
drop objects or run arbitrary destruction procedures. Removed objects can be stored into it by
An atomic pointer that can be safely shared between threads.
A garbage queue.
An owned heap-allocated object.
A pointer to an object protected by the epoch GC.
A witness that the current thread is pinned.
Scopes the current thread.
Creates an unprotected scope without pinning the current thread.