package eio
Build not yet checkedInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=a9771c0d7f4d9d9fe17badd3d147c96e85f34410ab252119ade2a407ab41ccb5
sha512=a6e0bfdc7d48886b613ba70004a46309e4162f6109d9603fbe9d70dafcc4fad3cd2382998685b1db4bb8e5bf0bbc89371b9023644d3bfaa80757e5e6939c6d8e
doc/eio/Eio/Stream/index.html
Module Eio.StreamSource
A stream/queue.
Reading from an empty queue will wait until an item is available. Writing to a full queue will wait until there is space.
Example:
let t = Stream.create 100 in
Stream.add t 1;
Stream.add t 2;
assert (Stream.take t = 1);
assert (Stream.take t = 2)Streams are thread-safe and so can be shared between domains and used to communicate between them.
A queue of items of type 'a.
create capacity is a new stream which can hold up to capacity items without blocking writers.
- If
capacity = 0then writes block until a reader is ready. - If
capacity = 1then this acts as a "mailbox". - If
capacity = max_intthen the stream is effectively unbounded.
add t item adds item to t.
If this would take t over capacity, it blocks until there is space.
take t takes the next item from the head of t.
If no items are available, it waits until one becomes available.
take_nonblocking t is like Some (take t) except that it returns None if the stream is empty rather than waiting.
Note that if another domain may add to the stream then a None result may already be out-of-date by the time this returns.