This repository was archived by the owner on Sep 8, 2025. It is now read-only.
refactor component model async host APIs#116
Merged
Merged
Conversation
rvolosatovs
approved these changes
Apr 10, 2025
Member
rvolosatovs
left a comment
There was a problem hiding this comment.
The API changes look good to me, did not review the implementation
rvolosatovs
reviewed
Apr 10, 2025
The main idea here is to remove the `Promise` abstraction (which turned out to
be leaky and awkward in practice, especially inside host functions) in favor of
plain `Future`s to represent CM async operations like guest tasks and
stream/future reads/writes.
Those `Future`s must be polled and/or `.await`ed from within the originating
instance's event loop. That happens automatically inside host functions, but
top-level code must use `Instance::{run,run_with,spawn}` to fulfil that
requirement. If such a `Future` is polled outside the event loop, it will
panic.
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
147283b to
a29bb6c
Compare
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
This regression was actually introduced back when I added waitable set support, but due to how the tests were being run we didn't notice it until my latest refactor. Signed-off-by: Joel Dice <joel.dice@fermyon.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The main idea here is to remove the
Promiseabstraction (which turned out to be leaky and awkward in practice, especially inside host functions) in favor of plainFutures to represent CM async operations like guest tasks and stream/future reads/writes.Those
Futures must be polled and/or.awaited from within the originating instance's event loop. That happens automatically inside host functions, but top-level code must useInstance::{run,run_with,spawn}to fulfil that requirement. If such aFutureis polled outside the event loop, it will panic.