Allow stream.{read,write}s of length 0 to query/signal readiness#444
Conversation
d9516ae to
d02e83b
Compare
d02e83b to
82c2ef6
Compare
|
Updated the PR based on further discussion in #441 about what happens when a |
|
cc @dicej on this as it relates to our discussion this morning. It looks like the wasip3-prototyping branch doesn't implement the spec as-is as 0-length reads/writes aren't trapped, and it also hasn't been updated to take this PR into account either. Basically I think wasip3-prototyping is an ambiguous state right now as to what 0-length reads/writes mean. Also question for you @lukewagner. The topic of 0-length reads/writes have come up in the context of figuring out what the result of an async stream operation is. Specifically I was attempting to model the result of a stream operation as a tri-state value of either (a) completed with N items, (b) closed, or (c) cancelled. Given the way the return codes map here though is it correct to say that if you cancel a 0-length operation there's no way to figure out what happened as a result? The canonical ABI code returned will be 0, maybe eventually, and that's ambiguous whether the read/write was cancelled or "completed"? |
|
You're right, as currently written, after a |
Updated to match WebAssembly/component-model#444 Signed-off-by: Joel Dice <joel.dice@fermyon.com>
|
Sounds like this has been implemented in wasip3-prototyping/#130 so I'll merge and we can iterate as necessary in follow-up issues and PRs. |
This PR relaxes the rules for
stream.{read,write}to accept lengths of0. This can be useful for signalling and querying readiness which in turn can be used to implement non-blocking POSIX operations, as discussed in #441.