Rwlock.Guard'k Rwlock.Guard.t represents a reader-writer lock that is locked exclusively for writing. It morally contains a Capsule.Key.t, but also has a finalizer that poisons the lock if the guard is garbage collected without being passed to Guard.release.
val with_key :
'a 'k. 'k t @ unique ->
(f:
('k Capsule.Key.t @ unique -> #('a * 'k Capsule.Key.t) @ unique once) @ local once ->
'a * 'k t @ unique once) @ oncewith_key t ~f runs f, providing it a key for 'k uniquely.
val with_password :
'a 'k. 'k t @ unique ->
(f:('k Capsule.Password.t @ local -> 'a @ unique) @ local once ->
'a * 'k t @ unique) @ oncewith_password g ~f runs f, providing it a password for 'k, and returns the result of f together with the guard.
val access :
'a 'k. 'k t @ unique ->
(f:
('k Capsule.Access.t -> 'a @ unique once portable contended) @ local once portable ->
'a * 'k t @ unique once portable contended) @ onceaccess g ~f runs f, providing it access to the capsule 'k, and returns the result of f together with the guard.
val release : 'k t @ unique -> unitrelease guard releases the lock protected by guard, consuming the guard.
val poison : 'k t @ unique -> 'k Capsule.Key.t @ uniquepoison guard poisons the lock protected by guard, consuming the guard and returning the key to the protected capsule.
val downgrade : 'k t @ unique -> 'k Shared_guard.t @ uniquedowngrade guard downgrades the write guard guard to a read guard.