Module Concurrent.MakeHashtbl

a thread safe hashtable

Parameters

module H : Stdlib.Hashtbl.S

Signature

module Hash = H
type key = H.key
type 'a t
val create : int -> 'a t
val clear : 'a t -> unit
val find_opt : 'a t -> key -> 'a option
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val iter : (key -> 'a -> unit) -> 'a t -> unit
val length : 'a t -> int
val remove : 'a t -> key -> unit
val replace : 'a t -> key -> 'a -> unit
val with_hashtable : ('a Hash.t -> 'b) -> 'a t -> 'b

Execute the given function on the underlying hashtable in a critical section

val wrap_hashtable : 'a Hash.t -> 'a t

Put a hashtable into a thread-safe wrapper; original hashtable must not be directly accessed.