package trace
A stub for tracing/observability, agnostic in how data is collected
Install
Dune Dependency
Authors
Maintainers
Sources
trace-0.6.tbz
sha256=97cc4159b96429adc01a84bff1ed34b8f06746bc56a40a214a6306036be2df38
sha512=6a67ea9ddeebb4b93a0b8dba9ed26d95e786722d08fd9ca7d8e2db7651a9b9d6ccc63cc437b4eb71c28b3ec51838716a84707a8d366abb595f32a5e65035e28b
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)"
>