otplike.timer

This namespace contains helper functions to perform process-related actions (like sending a message, or exit signal) with a delay.

Warning! The functions in this namespace use core.async’s timer internally. As of now the resolution of the timer is 10 ms. Which only says when the operation, waiting for the timeout, will be queued for execution. The actual execution begins even later.

apply-after

(apply-after msecs f)(apply-after msecs f args)

Applies f to args after msecs.

Returns the timer reference.

Throws on bad arguments.

apply-interval

(apply-interval msecs f)(apply-interval msecs f args)

Evaluates (! pid message) repeatedly at intervals of msecs.

Returns the timer reference.

Throws on bad arguments.

cancel

(cancel tref)

Cancels a previously requested timeout. tref is a unique timer reference returned by the related timer function.

Throws if tref is not a timer reference.

exit-after

(exit-after msecs reason)(exit-after msecs pid reason)

Sends an exit signal with reason reason to pid pid after msecs. pid can be a pid or a registered name.

Returns the timer reference.

Throws on bad arguments.

kill-after

(kill-after msecs)(kill-after msecs pid)

The same as exit-after called with reason :kill.

send-after

(send-after msecs message)(send-after msecs pid message)

Evaluates (! pid message) after msecs.

Returns the timer reference.

Throws on bad arguments.

send-interval

(send-interval msecs message)(send-interval msecs pid message)

Evaluates (! pid message) repeatedly at intervals of msecs.

Returns the timer reference.

Throws on bad arguments.