Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Lwt_preemptive

module Lwt_preemptive: sig..end

This module allows to mix preemptive threads with Lwt cooperative threads. It maintains an extensible pool of preemptive threads to with you can detach computations.


val detach : ('a -> 'b) -> 'a -> 'b Lwt.t

detaches a computation to a preemptive thread.

val init : int -> int -> (string -> unit) -> 'a Lwt.t

Should be called only once at the begining of the process. Arguments are: minimum number of threads, maximum number of threads and the function to log errors.

val set_max_number_of_threads_queued : int -> unit

Sets the size of the waiting queue, if no more threads are available

val get_max_number_of_threads_queued : unit -> int

Returns the size of the waiting queue, if no more threads are available