Struct crossbeam_epoch::internal::Global
source · pub(crate) struct Global {
locals: List<Local>,
queue: Queue<SealedBag>,
pub(crate) epoch: CachePadded<AtomicEpoch>,
}
Expand description
The global data for a garbage collector.
Fields§
§locals: List<Local>
The intrusive linked list of Local
s.
queue: Queue<SealedBag>
The global queue of bags of deferred functions.
epoch: CachePadded<AtomicEpoch>
The global epoch.
Implementations§
source§impl Global
impl Global
sourceconst COLLECT_STEPS: usize = 8usize
const COLLECT_STEPS: usize = 8usize
Number of bags to destroy.
sourcepub(crate) fn push_bag(&self, bag: &mut Bag, guard: &Guard)
pub(crate) fn push_bag(&self, bag: &mut Bag, guard: &Guard)
Pushes the bag into the global queue and replaces the bag with a new empty bag.
sourcepub(crate) fn collect(&self, guard: &Guard)
pub(crate) fn collect(&self, guard: &Guard)
Collects several bags from the global queue and executes deferred functions in them.
Note: This may itself produce garbage and in turn allocate new bags.
pin()
rarely calls collect()
, so we want the compiler to place that call on a cold
path. In other words, we want the compiler to optimize branching for the case when
collect()
is not called.
sourcepub(crate) fn try_advance(&self, guard: &Guard) -> Epoch
pub(crate) fn try_advance(&self, guard: &Guard) -> Epoch
Attempts to advance the global epoch.
The global epoch can advance only if all currently pinned participants have been pinned in the current epoch.
Returns the current global epoch.
try_advance()
is annotated #[cold]
because it is rarely called.