tiny_httpd/src/Tiny_httpd_pool.mli
2023-06-21 01:11:58 -04:00

12 lines
350 B
OCaml

(** Resource pool *)
type 'a t
(** Pool of values of type ['a] *)
val create : mk_item:(unit -> 'a) -> ?max_size:int -> unit -> 'a t
(** Create a new pool. *)
val with_resource : 'a t -> ('a -> 'b) -> 'b
(** [with_resource pool f] runs [f x] with [x] a resource;
when [f] fails or returns, [x] is returned to the pool for
future reuse. *)