package picos_std
Sample libraries for Picos
Install
Dune Dependency
Authors
Maintainers
Sources
picos-0.6.0.tbz
sha256=3f5a08199cf65c2dae2f7d68f3877178f1da8eabf5376e15114e5a8958087dfa
sha512=ad24910c47ce614268c4268874bb918da7f8b5f03b3ad706bbf30323635262e94ddab6be24eaebbca706bfa82c0a517d4272b396459e020c185942125c9bdb7b
doc/src/picos_std.sync/stream.ml.html
Source file stream.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 39 40 41 42 43 44 45 46 47 48 49 50
open Picos open Picos_std_event type 'a cursor = Cons of ('a * 'a cursor) Computation.t [@@unboxed] type 'a t = 'a cursor Atomic.t let[@inline] advance t tail curr = if Atomic.get t == Cons tail then Atomic.compare_and_set t (Cons tail) curr |> ignore let[@inline] help t tail = let _, curr = Computation.peek_exn tail in advance t tail curr let create ?padded () = Multicore_magic.copy_as ?padded (Atomic.make (Cons (Computation.create ~mode:`LIFO ()))) let rec push t ((_, curr) as next) backoff = let (Cons tail) = Atomic.get t in if Computation.try_return tail next then advance t tail curr else let backoff = Backoff.once backoff in help t tail; push t next backoff let push t value = let next = (value, Cons (Computation.create ~mode:`LIFO ())) in push t next Backoff.default let rec poison_at t exn bt backoff = let (Cons tail) = Atomic.get t in if not (Computation.try_cancel tail exn bt) then begin let backoff = Backoff.once backoff in help t tail; poison_at t exn bt backoff end let peek_opt (Cons at) = match Computation.peek_exn at with | value -> Some value | exception Computation.Running -> None let poison_at t exn bt = poison_at t exn bt Backoff.default let tap = Atomic.get let read (Cons at) = Computation.await at let read_evt (Cons at) = Event.from_computation at let[@inline always] poison ?(callstack = 0) t exn = poison_at t exn (Printexc.get_callstack callstack)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>