Module Cattery

type 'a t
val create : ?validate:('a -> bool) -> ?dispose:('a -> unit) -> int -> (unit -> 'a) -> 'a t

create n alloc is a fresh pool which allows up to n resources to be live at a time. It uses alloc to create new resources as needed. If alloc raises an exception then that us fails, but future calls to use will retry.

val use : 'a t -> ?never_block:bool -> ('a -> 'b) -> 'b