Duppy.AsyncAsynchronous task module * * This module implements an asychronous API to Duppy.scheduler * It allows to create a task that will run and then go to sleep.
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 -> unitWake up an asynchronous task. * Raises Stopped if the task has been stopped.
val stop : t -> unitStop and remove the asynchronous task. Doesn't quit a running task. * Raises Stopped if the task has been stopped.