Skip to main content

drain_expired_timers

Function drain_expired_timers 

Source
pub fn drain_expired_timers(timers: &Arc<Mutex<Vec<TimerEntry>>>) -> Vec<u32>
Expand description

Remove due timers from timers, collect each fired entry’s TimerEntry::callback_id, and return them.

Compares each TimerEntry::fire_at against Instant::now(). One-shot entries (interval is None) are removed from the vector after firing. Interval entries are kept and their fire_at is advanced by interval so they fire again later. The host typically calls the guest’s on_timer once per id in the returned vector.