Skip to main content

Module timer

Module timer 

Source
Expand description

Live timer scheduling and callback dispatch.

§Scheduling

Runtime deadlines use the remaining duration to the nominal schedule and are computed before the timer task is spawned. A deadline already in the past starts immediately. Event timestamps retain the nominal schedule, and stop times are inclusive.

§Task lifecycle

Each LiveTimer::start creates fresh public schedule and task-state atomics. Because aborting a runtime task does not join it, task retirement linearizes restart, cancellation, and drop against event reservation. Retirement either prevents the old task from dispatching or observes the schedule advanced by its reserved event; fresh atomics keep that task from overwriting its replacement’s schedule.

§Callback dispatch

Thread-safe callbacks cross the worker boundary as TimeEventMessage values. RustLocal callbacks remain in an owner-thread registry and cross the boundary only through tokens and leases. Senderless Python callbacks run inline and publish their following schedule after the callback returns.

Structs§

LiveTimer
A live timer for use with a LiveClock.