package devkit

  1. Overview
  2. Docs

Thread utilities

val locked : Stdlib.Mutex.t -> (unit -> 'a) -> 'a
type 'a t
val detach : ('a -> 'b) -> 'a -> 'b t
val join : 'a t -> 'a Exn.result
val join_exn : 'a t -> 'a
val map : ('a -> 'b) -> 'a array -> 'b array

parallel Array.map

val mapn : ?n:int -> ('a -> 'b) -> 'a list -> 'b Exn.result list

parallel map with the specified number of workers, default=8

module LockMutex : sig ... end
module Async_fin : sig ... end

Communication from worker threads to the main event loop

val log_create : ?name:string -> ('a -> unit) -> 'a -> Thread.t

Create new thread wrapped in Action.log

val run_periodic : delay:float -> ?now:bool -> (unit -> bool) -> unit

run f in thread periodically once in delay seconds.

  • parameter f

    returns false to stop the thread, true otherwise

  • parameter now

    default false

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

Thread workers

module Pool : sig ... end
OCaml

Innovation. Community. Security.