Struct crossbeam_epoch::internal::Local
source · #[repr(C)]pub(crate) struct Local {
entry: Entry,
collector: UnsafeCell<ManuallyDrop<Collector>>,
pub(crate) bag: UnsafeCell<Bag>,
guard_count: Cell<usize>,
handle_count: Cell<usize>,
pin_count: Cell<Wrapping<usize>>,
epoch: CachePadded<AtomicEpoch>,
}
Expand description
Participant for garbage collection.
Fields§
§entry: Entry
A node in the intrusive linked list of Local
s.
collector: UnsafeCell<ManuallyDrop<Collector>>
A reference to the global data.
When all guards and handles get dropped, this reference is destroyed.
bag: UnsafeCell<Bag>
The local bag of deferred functions.
guard_count: Cell<usize>
The number of guards keeping this participant pinned.
handle_count: Cell<usize>
The number of active handles.
pin_count: Cell<Wrapping<usize>>
Total number of pinnings performed.
This is just an auxiliary counter that sometimes kicks off collection.
epoch: CachePadded<AtomicEpoch>
The local epoch.
Implementations§
source§impl Local
impl Local
sourceconst PINNINGS_BETWEEN_COLLECT: usize = 128usize
const PINNINGS_BETWEEN_COLLECT: usize = 128usize
Number of pinnings after which a participant will execute some deferred functions from the global queue.
sourcepub(crate) fn register(collector: &Collector) -> LocalHandle
pub(crate) fn register(collector: &Collector) -> LocalHandle
Registers a new Local
in the provided Global
.
sourcepub(crate) fn global(&self) -> &Global
pub(crate) fn global(&self) -> &Global
Returns a reference to the Global
in which this Local
resides.
sourcepub(crate) fn collector(&self) -> &Collector
pub(crate) fn collector(&self) -> &Collector
Returns a reference to the Collector
in which this Local
resides.
sourcepub(crate) unsafe fn defer(&self, deferred: Deferred, guard: &Guard)
pub(crate) unsafe fn defer(&self, deferred: Deferred, guard: &Guard)
Adds deferred
to the thread-local bag.
§Safety
It should be safe for another thread to execute the given function.
pub(crate) fn flush(&self, guard: &Guard)
sourcepub(crate) fn acquire_handle(&self)
pub(crate) fn acquire_handle(&self)
Increments the handle count.
sourcepub(crate) fn release_handle(&self)
pub(crate) fn release_handle(&self)
Decrements the handle count.