Skip to content

Timers and tickers

Category: Async · Status: stub · Lessons: chapter 06, Async (planned)

One line: A runtime facility that fires once after a delay, or repeatedly at an interval, and delivers it as a callback, a value on a channel, or something to await.

Also called: ticker, interval, setTimeout.

How it connects

In each language

Rust Tokio's time module: sleep, interval and timeout
Go time.Timer and time.Ticker, each delivering on a channel
Java ScheduledExecutorService runs tasks after a delay or periodically
Python loop.call_later on the event loop, and threading.Timer for threads
C# PeriodicTimer, whose ticks are awaited
JavaScript setTimeout and setInterval
The operating system timerfd_create makes a timer readable as a file descriptor, so an event loop can wait on it

Where to read more