package b0

  1. Overview
  2. Docs

Build operation executors.

An executor is a parallel asynchronous work queue. It has no notion of synchronisation, any scheduled operation is randomly executed in parallel up to the executor's parallelizing limits.

Executors

type feedback = [
  1. | `Exec_submit of B0_std.Os.Cmd.pid option * Op.t
]

The type for executor feedbacks.

val pp_feedback : feedback B0_std.Fmt.t

pp_feedback formats executor feedback.

type t

The type for executors.

val create : ?clock:B0_std.Time.counter -> ?rand:Random.State.t -> ?tmp_dir:B0_std.Fpath.t -> ?feedback:(feedback -> unit) -> max_spawn:int -> unit -> t

create ~clock ~rand ~tmp_dir ~notify_submit ~max_spawn with:

val schedule : t -> Op.t -> unit

schedule e o schedules o for execution in e. Just before o is actually submitted for execution it is given to the notify_submit callback of e (see create).

val collect : t -> block:bool -> Op.t option

collect e ~block removes from e an operation that has completed (if any). If block is false and no completed operation exists, the call returns immediately with None. If block is true and at least one incomplete operation exists in e, the call blocks until an operation completes. If block is true and no operation exists in e None is returned.

OCaml

Innovation. Community. Security.