Stop the timer.
Stop the timer. Pending tasks are cancelled. The timer is unusable after being stopped.
Performs an operation at the specified time.
Performs an operation after the specified delay.
Run f
every elapsed period
, starting period
from now.
Run f
at time when
; subsequently run f
at every elapsed period
.
Run f
at time when
; subsequently run f
at every elapsed period
.
If when
is negative or undefined, it will be treated as Time.epoch.
If period
is negative or undefined, the timer task will be rescheduled
immediately (i.e., period
will be treated as Duration.Zero).
Run f
at time when
.
Run f
at time when
.
If when
is negative or undefined, it will be treated as Time.epoch.
Timers are used to schedule tasks in the future. They support both one-shot and recurring tasks.
Timers propagate Local state, including the Monitor, from when the task is scheduled to when it is run.
Scheduling tasks with Timers should rarely be done directly; for example, when programming with Futures, prefer using Future.sleep.
MockTimer for use in tests that require determinism.