#[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: EntryA node in the intrusive linked list of Locals.
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.