Module Lwt_mutex


module Lwt_mutex: sig .. end
with_lock lock f is used to lock a mutex within a block scope. The function f () is called with the mutex locked, and its result is returned from the call to . If an exception is raised from f, the mutex is also unlocked before the scope of is exited.

type t 
val create : unit -> t
val lock : t -> unit Lwt.t
val unlock : t -> unit
val with_lock : t -> (unit -> 'a Lwt.t) -> 'a Lwt.t
with_lock lock f is used to lock a mutex within a block scope. The function f () is called with the mutex locked, and its result is returned from the call to . If an exception is raised from f, the mutex is also unlocked before the scope of is exited.