Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Locks for mutual exclusion
val create : unit -> t
Return a fresh mutex.
val lock : t -> unit
Lock the given mutex. Locks are not assumed to be re-entrant.
val unlock : t -> unit
Unlock the mutex. If any threads are attempting to lock the mutex, exactly one of them will gain access to the lock.
val with_lock : t -> (unit -> 'a) -> 'a
with_lock t f
first obtains t
, then computes f ()
, and finally unlocks t
.