with_lockspace lockspace ~f opens an existing lockspace, calls f t with the lockspace handle t, and closes the lockspace after f terminates. The lockspace is also automatically closed on process exit.
Locks
Locks are a named cluster-wide resource inside a specific lockspace.
Only a simplified interface is provided that acquires a lock, performs an operation and releases it. Locking can be nested, even with same lock name, but note that trying to acquire an exclusive lock twice will fail.
It is recommended to use the LKM_PRMODE mode for reading and LKM_EXMODE for writing.
with_lock lshandle ?mode ?try_ ?timeout lockname ~f acquires lockname in lockmode and calls f when the lock is acquired. Releases the lock after f terminates.