From 7eec1982311326ebbc97d9ce54ce068e82ef016f Mon Sep 17 00:00:00 2001
From: Dave Bakker subscribe
function to obtain a po
for using
wasi:io/poll
.
resource output-stream
An output bytestream.
-output-stream
s are non-blocking to the extent practical on
+output-stream
s are non-blocking to the extent practical on
underlying platforms. Except where specified otherwise, I/O operations also
always return promptly, after the number of bytes that can be written
promptly, which could even be zero. To wait for the stream to be ready to
accept data, the subscribe
function to obtain a pollable
which can be
-polled for using wasi:io/poll
.
+polled for using wasi:io/poll
.
output-stream
while there's still an active write in
+progress may result in the data being lost. Before dropping the stream,
+be sure to fully flush your writes.[method]input-stream.read: func
Perform a non-blocking read from the stream.
diff --git a/wit/streams.wit b/wit/streams.wit index a57f204..6b8953e 100644 --- a/wit/streams.wit +++ b/wit/streams.wit @@ -112,6 +112,10 @@ interface streams { /// promptly, which could even be zero. To wait for the stream to be ready to /// accept data, the `subscribe` function to obtain a `pollable` which can be /// polled for using `wasi:io/poll`. + /// + /// Dropping an `output-stream` while there's still an active write in + /// progress may result in the data being lost. Before dropping the stream, + /// be sure to fully flush your writes. @since(version = 0.2.0) resource output-stream { /// Check readiness for writing. This function never blocks.