Skip to content

Commit 7eec198

Browse files
committed
Clarify behavior when dropping an active output-stream
1 parent edfb408 commit 7eec198

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

imports.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,15 @@ use the <code>subscribe</code> function to obtain a <a href="#pollable"><code>po
133133
for using <code>wasi:io/poll</code>.</p>
134134
<h4><a name="output_stream"></a><code>resource output-stream</code></h4>
135135
<p>An output bytestream.</p>
136-
<h2><a href="#output_stream"><code>output-stream</code></a>s are <em>non-blocking</em> to the extent practical on
136+
<p><a href="#output_stream"><code>output-stream</code></a>s are <em>non-blocking</em> to the extent practical on
137137
underlying platforms. Except where specified otherwise, I/O operations also
138138
always return promptly, after the number of bytes that can be written
139139
promptly, which could even be zero. To wait for the stream to be ready to
140140
accept data, the <code>subscribe</code> function to obtain a <a href="#pollable"><code>pollable</code></a> which can be
141-
polled for using <code>wasi:io/poll</code>.</h2>
141+
polled for using <code>wasi:io/poll</code>.</p>
142+
<h2>Dropping an <a href="#output_stream"><code>output-stream</code></a> while there's still an active write in
143+
progress may result in the data being lost. Before dropping the stream,
144+
be sure to fully flush your writes.</h2>
142145
<h3>Functions</h3>
143146
<h4><a name="method_input_stream_read"></a><code>[method]input-stream.read: func</code></h4>
144147
<p>Perform a non-blocking read from the stream.</p>

wit/streams.wit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ interface streams {
112112
/// promptly, which could even be zero. To wait for the stream to be ready to
113113
/// accept data, the `subscribe` function to obtain a `pollable` which can be
114114
/// polled for using `wasi:io/poll`.
115+
///
116+
/// Dropping an `output-stream` while there's still an active write in
117+
/// progress may result in the data being lost. Before dropping the stream,
118+
/// be sure to fully flush your writes.
115119
@since(version = 0.2.0)
116120
resource output-stream {
117121
/// Check readiness for writing. This function never blocks.

0 commit comments

Comments
 (0)