Module Imandrakit_thread.Thread_pool

Thread Pool.

This is a wrapper around moonpool's thread pools.

type t = Executor.t
val start : ?active:Imandrakit_sync.Switch.t -> ?on_exn:(exn -> Stdlib.Printexc.raw_backtrace -> unit) -> ?kind:[ `Fifo | `WorkStealing ] -> name:string -> j:int -> unit -> t

Start a new pool with j job runners.

  • parameter on_exn

    called when a task fails.

  • parameter j

    number of thread workers. Must be positive.

  • parameter kind

    the underlying pool implementation. See Moonpool for more details.

val with_ : ?active:Imandrakit_sync.Switch.t -> ?on_exn:(exn -> Stdlib.Printexc.raw_backtrace -> unit) -> ?kind:[ `Fifo | `WorkStealing ] -> name:string -> j:int -> unit -> (t -> 'a) -> 'a
val default_size : unit -> int

Recommended size for a thread pool