package picos_std
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=3f5a08199cf65c2dae2f7d68f3877178f1da8eabf5376e15114e5a8958087dfa
sha512=ad24910c47ce614268c4268874bb918da7f8b5f03b3ad706bbf30323635262e94ddab6be24eaebbca706bfa82c0a517d4272b396459e020c185942125c9bdb7b
doc/picos_std.sync/Picos_std_sync/Stream/index.html
Module Picos_std_sync.Stream
Source
A lock-free, poisonable, many-to-many, stream.
Readers can tap
into a stream to get a cursor
for reading all the values pushed to the stream starting from the cursor
position. Conversely, values pushed to a stream are lost unless a reader has a cursor
to the position in the stream.
Represents a stream of values of type 'a
.
poison_at stream exn bt
marks the stream as poisoned at the current position, which means that subsequent attempts to push
to the stream
will raise the given exception with backtrace.
ℹ️ This operation is not cancelable.
poison stream exn
is equivalent to poison_at stream exn (Printexc.get_callstack n)
where n
defaults to 0
.
Represents a (past or current) position in a stream.
peek_opt cursor
immediately returns Some (value, next)
with the value
pushed to the position and a cursor to the next
position, when the cursor
points to a past position in the stream. Otherwise returns None
or raises the exception that the stream was poisoned with.
read cursor
immediately returns (value, next)
with the value
pushed to the position and a cursor to the next
position, when the cursor
points to a past position in the stream. If the cursor
points to the current position of the stream, read cursor
waits until a value is pushed to the stream or the stream is poisoned, in which case the exception that the stream was poisoned with will be raised.
read_evt cursor
returns an event that reads from the cursor
position.