feat(c): Add co-op threading builtins to C generator #1491
Merged
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.
Adds the co-op threading builtins for the component model to the C generator. This is needed for work on wasip3 in
wasi-libc.Some design decisions we may want to go a different way on:
context_get/setnow take an additional parameter indicating which context slot to operate on. We could maintain the old versions, but I think this will be an easy fix for anyone who is using them.<world>_yieldhas been renamed<world>_thread_yieldfor parity with the other builtins. I think this is a similarly easy fix for users.-W component-model-threading -W component-model-async-stackful, or they would see instantiation errors indicating to add those flags. I'm happy to split them out if we think that's the best approach.--generate-async-helpersflag to force generation of the async helpers in situations where you don't have any futures or functions markedasync, but you still want the threading builtins.Rust support can be done in a follow-up PR; I'm not familiar with the design of the Rust guest generator, so focused on this part that is needed for
wasi-libc.