package moonpool
Pools of threads supported by a pool of domains
Install
dune-project
Dependency
Authors
Maintainers
Sources
moonpool-0.9.tbz
sha256=7194610ba86525f05f9cda15c6f28790ab15804e840bc71269f4590d81d8a390
sha512=625092e840589f2fd46ab88cf72714f4b415d8de0d50e46d4c202149ad7d4e38416a2c5f0100addc23781d6000d3951682b22a915af7f0f69d260d7cf4add9de
doc/moonpool.sync/Moonpool_sync/Lock/index.html
Module Moonpool_sync.Lock
Source
Mutex-protected resource.
This lock is a synchronous concurrency primitive, as a thin wrapper around Mutex
that encourages proper management of the critical section in RAII style:
let (let@) = (@@)
…
let compute_foo =
(* enter critical section *)
let@ x = Lock.with_ protected_resource in
use_x;
return_foo ()
(* exit critical section *)
in
…
This lock is based on Picos_sync.Mutex
so it is await
-safe.
A value protected by a cooperative mutex
with_ l f
runs f x
where x
is the value protected with the lock l
, in a critical section. If f x
fails, with_lock l f
fails too but the lock is released.
update l f
replaces the content x
of l
with f x
, while protected by the mutex.
update_map l f
computes x', y = f (get l)
, then puts x'
in l
and returns y
, while protected by the mutex.
Underlying mutex.
Atomically get the value in the lock. The value that is returned isn't protected!
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>