Ocsigen

This is a preliminary version of the documentation. Help us to improve it by filling tickets. We are looking for native english speakers to proof read the documentation. Contact us!

Module Preemptive


module 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