pub(crate) struct Level {
level: usize,
occupied: u64,
slot: [LinkedList<TimerShared, TimerShared>; 64],
}
Expand description
Wheel for a single level in the timer. This wheel contains 64 slots.
Fields§
§level: usize
§occupied: u64
Bit field tracking which slots currently contain entries.
Using a bit field to track slots that contain entries allows avoiding a scan to find entries. This field is updated when entries are added or removed from a slot.
The least-significant bit represents slot zero.
slot: [LinkedList<TimerShared, TimerShared>; 64]
Slots. We access these via the EntryInner current_list
as well, so this needs to be an UnsafeCell
.
Implementations§
source§impl Level
impl Level
pub(crate) fn new(level: usize) -> Level
sourcepub(crate) fn next_expiration(&self, now: u64) -> Option<Expiration>
pub(crate) fn next_expiration(&self, now: u64) -> Option<Expiration>
Finds the slot that needs to be processed next and returns the slot and
Instant
at which this slot must be processed.
fn next_occupied_slot(&self, now: u64) -> Option<usize>
pub(crate) unsafe fn add_entry(&mut self, item: TimerHandle)
pub(crate) unsafe fn remove_entry(&mut self, item: NonNull<TimerShared>)
pub(crate) fn take_slot( &mut self, slot: usize, ) -> LinkedList<TimerShared, TimerShared>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Level
impl !RefUnwindSafe for Level
impl Send for Level
impl Sync for Level
impl Unpin for Level
impl !UnwindSafe for Level
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more