clock

Function clock 

Source
pub async fn clock(inbox: Receiver<Val>, back: Sender<Event>)
Expand description

('host clock): nothing in the floor can read a clock and nothing in a task can wait for anything but a message.

('now) milliseconds since the epoch ('sleep ms) 'ok, that much later ('after ms to msg) msg is posted to to, that much later

after is a cast, since the task that arms a timer is usually not the one that should hear it fire. It is what a timeout is built from: the dispatch loop arms one carrying the reply it wants, and the duplicate-reply path drops whichever loses (naj/prelude.naj).

Each timer is a task that sleeps and then sends, so nothing is polled. It holds a port, which keeps a world with a timer outstanding from concluding that nothing could wake it.