Module B00.Exec

module Exec: sig .. end
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.


type feedback = [ `Exec_submit of option * B00.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 -> B00.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 B00.Exec.create).
val collect : t -> block:bool -> B00.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.