package trace
A stub for tracing/observability, agnostic in how data is collected
Install
Dune Dependency
Authors
Maintainers
Sources
trace-0.7.tbz
sha256=ebd0be29b30b49536c9659882790b9f0c121ffb06c0bec2eaeba8cfed4909339
sha512=d14b72db713315093c931351b9b04d2fd5ce793a8595970fa31cbf71477516ef25de129adddf4075514581fe9ea3e27d998530efacb17c0d00bb5616b8d18b91
doc/src/trace_private_util/mpsc_bag.ml.html
Source file mpsc_bag.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
module A = Trace_core.Internal_.Atomic_ type 'a t = { bag: 'a list A.t } [@@unboxed] let create () = let bag = A.make [] in { bag } module Backoff = struct type t = int let default = 2 let once (b : t) : t = for _i = 1 to b do Domain_util.cpu_relax () done; min (b * 2) 256 end let rec add backoff t x = let before = A.get t.bag in let after = x :: before in if not (A.compare_and_set t.bag before after) then add (Backoff.once backoff) t x let[@inline] add t x = add Backoff.default t x let[@inline] pop_all t : _ list option = match A.exchange t.bag [] with | [] -> None | l -> Some (List.rev l)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>