package picos_std
Sample libraries for Picos
Install
Dune Dependency
Authors
Maintainers
Sources
picos-0.5.0.tbz
sha256=862d61383e2df93a876bedcffb1fd1ddc0f96c50b0e9c07943a2aee1f0e182be
sha512=87805379017ef4a7f2c11b954625a3757a0f1431bb9ba59132202de278b3e41adbe0cdc20e3ab23b7c9a8c5a15faeb7ec79348e7d80f2b14274b00df0893b8c0
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
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 create ?padded () = Multicore_magic.copy_as ?padded (Atomic.make (Cons (Computation.create ~mode:`LIFO ()))) 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.await tail in advance t tail curr 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 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 t exn bt backoff end let peek_opt (Cons at) = if Computation.is_running at then None else Some (Computation.await at) let poison t exn bt = poison 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
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>