Legend:
Library
Module
Module type
Parameter
Class
Class type
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.
push stream value adds the value to the current position of the stream and advances the stream to the next position unless the stream has been poisoned in which case only the exception given to poison will be raised.
val poison : 'at->exn ->Stdlib.Printexc.raw_backtrace -> unit
poison 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.
type!'a cursor
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.