package devkit

  1. Overview
  2. Docs

Parallel

val invoke : ('a -> 'b) -> 'a -> unit -> 'b

Invoke function in a forked process and return result

val launch_forks : ('a -> unit) -> 'a list -> unit

Launch function for each element of the list in the forked process. Does not wait for children to finish - returns immediately.

val run_forks : ?wait_stop:int -> ?revive:bool -> ?wait:int -> ?workers:int -> ('a -> unit) -> 'a list -> unit

Launch forks for each element of the list and wait for all workers to finish. Pass exit signals to the workers, see Forks.stop for the description of wait_stop parameter.

  • parameter revive

    to keep workers running (restarting with same param if exited) default: false

val run_forks' : ('a -> unit) -> 'a list -> unit

Same as run_forks but do not fork for one worker

val run_workers : int -> ?wait_stop:int -> ('a -> unit) -> 'a list -> unit

Process list with specified number of workers. Pass exit signals to the workers, see Forks.stop for the description of wait_stop parameter.

val run_workers_enum : int -> ?wait_stop:int -> ('a -> 'b) -> ('b -> unit) -> 'a Enum.t -> unit

Process enum with specified number of workers, collect results via provided callback. Pass exit signals to the workers, see Forks.stop for the description of wait_stop parameter.

module type WorkerT = sig ... end
module type Workers = sig ... end
module Forks (T : WorkerT) : Workers with type task = T.task and type result = T.result

Forked workers