Replace 'sync' with 'cancellable' in wait/poll/yield #548
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR offers a better solution to the issue described in #546 (in which dependency code doesn't want to receive cancellation events it doesn't know what to do with). Instead of coupling "cancellable" to "async", this PR splits them into two separate immediates, replacing the optional
async
immediate onyield
/wait
/poll
withcancellable
. Since this immediate was not included in the 0.3.0 release, but rather as part of a later 🚟 stackful async release, this shouldn't require any change to 0.3.0 implementations (other than perhaps s/async
/cancellable
/ in not-yet-implemented validation errors).A more subtle change in this PR that also doesn't change observable behavior in 0.3.0, but does for the later 🚟 stackful async release, is that synchronous builtins and
canon lower
no longer have "suspend the component instance" semantics. Instead, the desired "non-reentrancy of sync andasync callback
core wasm code" invariant is achieved far more directly as part of the semantics ofcanon lift
.Some advantages of these changes (in the stackful async / cooperative threads timeframe):
async
ABI options are no longer overloaded and decoupled from (1) cancellability, (2) serialization.cancellable
to more built-ins and evencanon lower
for both sync andasync
, allowing cancellation to be delivered promptly in more cases.