Module Qcow_rwlock.Write

val with_lock : ?⁠client:Client.t -> t -> (unit -> 'a Lwt.t) -> 'a Lwt.t

with_lock ?client t f executes f () when no-other client is holding the lock for reading or writing. Note this means that I may hold the lock for reading and then re-lock it for writing.

val try_lock : ?⁠client:Client.t -> t -> lock option

try_lock ?client t acquires a write lock on t if immediately possible, or returns None