Module Duppy.Async


module Async: sig .. end


Asynchronous task module for Duppy

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 Stoped
Exception raised when trying to wake_up a task that has been previously stoped
val add : priority:'a -> 'a Duppy.scheduler -> (unit -> unit) -> t
add ~priority s f creates an asynchronous task in s with priority priority.

The task executes the function f, and go to sleep. Use wake_up to resume the task and execute f again.

val wake_up : t -> unit
Wake up an asynchronous task. Raises Stoped if the task has been stoped.
val stop : t -> unit
Stop and remove the asynchronous task. Doesn't quit a running task. Raises Stoped if the task has been stoped.