Await_capsule.With_mutexAn 'a Capsule.With_mutex.t is a value of type 'a in its own capsule, protected by a mutex
create f runs f within a fresh capsule, and creates a Capsule.With_mutex.t containing the result
val of_isolated : 'a Portable_kernel.Capsule.Isolated.t @ unique -> 'a tof_isolated isolated creates a Capsule.With_mutex.t from a value in an isolated capsule, consuming the isolated capsule.
val with_lock :
'a 'b. Await_kernel.Await.t @ local ->
('a t ->
(f:('a -> 'b @ portable contended) @ local once portable ->
'b @ portable contended) @ local) @ localwith_lock t ~f locks the mutex associated with t and calls f on the protected value, returning the result.
val iter :
Await_kernel.Await.t @ local ->
('a t ->
(f:('a -> Base.unit) @ local once portable ->
Base.unit) @ local) @ localiter t ~f is with_lock t ~f, specialised to a function that returns unit
val map :
Await_kernel.Await.t @ local ->
('a t ->
(f:('a -> 'b) @ local once portable ->
'b t) @ local) @ localmap t ~f locks the mutex associated with t and calls f on the protected value, returning a new With_mutex.t containing the result in the same capsule, and protected by the same mutex.
val destroy : Await_kernel.Await.t @ local -> ('a t -> 'a) @ localdestroy t poisons the mutex associated with t, merging the protected value into the current capsule and returning it.