Module Async.Unix

Basic abstraction for a worker.

type t

A task

type outcome = [
  1. | `Success
  2. | `Cancelled
  3. | `Failure of string
]
val outcome_t : outcome Irmin.Type.t
type status = [
  1. | outcome
  2. | `Running
]
val status_t : status Irmin.Type.t
val async : (unit -> unit) -> t

Start a task.

val await : t -> [> outcome ] Lwt.t

If running, wait for a task to finish and return its outcome.

If not running, return the oucome of the task.

val status : t -> [> status ]

If running, refresh the status of the task, without blocking.

If not running, return the oucome of the task.

val cancel : t -> bool

If running, cancel the task and return true.

If not running, do nothing and return false.