package qcow

  1. Overview
  2. Docs

Exclusive write locks

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

with_lock t f executes f () with the lock held for writing

val with_locks : ?client:Client.t -> t -> first:Qcow_types.Cluster.t -> last:Qcow_types.Cluster.t -> (unit -> 'a Lwt.t) -> 'a Lwt.t

with_locks t ~first ~last f executes f () with all clusters in the interval first .. last inclusive locked for writing.

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

try_lock ?client t cluster returns a write lock on cluster if it can be done without blocking, or returns None.