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 Lwt_pool


module Lwt_pool: sig .. end
Creating pools (for example pools of connections to a database).


Instead of creating a new connection each time you need one, keep a pool of opened connections and reuse opened connections that are free.
type 'a t 
Type of pools
val create : int ->
?check:('a -> (bool -> unit) -> unit) -> (unit -> 'a Lwt.t) -> 'a t
create n f creates a new pool with at most n members. f is the function to use to create a new pool member.
val use : 'a t -> ('a -> 'b Lwt.t) -> 'b Lwt.t
use p f takes one free member of the pool p and gives it to the function f.