Replace 'sync' with 'cancellable' in wait/poll/yield#548
Merged
lukewagner merged 1 commit intomainfrom Jul 30, 2025
Merged
Conversation
6b46702 to
291c129
Compare
alexcrichton
approved these changes
Jul 28, 2025
Replace instance-suspension semantics of sync lower with instance-locking semantics in lift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
asyncimmediate onyield/wait/pollwithcancellable. 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 lowerno longer have "suspend the component instance" semantics. Instead, the desired "non-reentrancy of sync andasync callbackcore 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):
asyncABI options are no longer overloaded and decoupled from (1) cancellability, (2) serialization.cancellableto more built-ins and evencanon lowerfor both sync andasync, allowing cancellation to be delivered promptly in more cases.