module Async:sig
..end
This module implements an asychronous API to Duppy.scheduler
It allows to create a task that will run and then go to sleep.
type
t
exception Stopped
val add : priority:'a -> 'a Duppy.scheduler -> (unit -> float) -> t
add ~priority s f
creates an asynchronous task in s
with
priority priority
.
The task executes the function f
.
If the task returns a positive float, the function will be executed
again after this delay. Otherwise it goes to sleep, and
you can use wake_up
to resume the task and execute f
again.
Only a single call to f
is done at each time.
Multiple wake_up
while previous task has not
finished will result in sequentialized calls to f
.
val wake_up : t -> unit
Stopped
if the task has been stopped.val stop : t -> unit
Stopped
if the task has been stopped.