Skip to main content

Module time

Module time 

Source
Expand description

Async timer primitives: [sleep], sleep_until, [interval].

All timers are driven by a per-thread hierarchical timer wheel integrated into the executor run loop. The wheel is ticked each iteration of the loop; expired timers fire their wakers, re-scheduling the waiting tasks.

§Thread-local timer wheel

The TIMER_WHEEL thread-local holds the wheel for the current executor thread. with_timer_wheel provides safe, borrow-scoped mutable access.

Re-exports§

pub use interval::interval;
pub use interval::Interval;
pub use sleep::sleep;
pub use sleep::sleep_until;
pub use sleep::Sleep;

Modules§

interval
Interval — periodic timer that fires at a fixed rate.
sleep
Sleep future — resolves after a given Duration.
wheel
Hierarchical timer wheel — O(1) insert/cancel, O(levels) tick.