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/src/moonpool.sync/lock.ml.html
Source file lock.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
module Mutex = Picos_std_sync.Mutex type 'a t = { mutex: Mutex.t; mutable content: 'a; } let create content : _ t = { mutex = Mutex.create (); content } let with_ (self : _ t) f = Mutex.lock self.mutex; try let x = f self.content in Mutex.unlock self.mutex; x with e -> Mutex.unlock self.mutex; raise e let[@inline] mutex self = self.mutex let[@inline] update self f = with_ self (fun x -> self.content <- f x) let[@inline] update_map l f = with_ l (fun x -> let x', y = f x in l.content <- x'; y) let get l = Mutex.lock l.mutex; let x = l.content in Mutex.unlock l.mutex; x let set l x = Mutex.lock l.mutex; l.content <- x; Mutex.unlock l.mutex
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>