Skip to content

Spawn through the wasip3_task_vtable - #1721

Merged
alexcrichton merged 2 commits into
bytecodealliance:mainfrom
alexcrichton:spawn-across-versions
Sep 25, 2026
Merged

alexcrichton merged 2 commits into
bytecodealliance:mainfrom
alexcrichton:spawn-across-versions

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

This commit adds hooks in the C ABI portion of this crate to spawn Rust tasks. This fixes the issue where spawned tasks by any particular version of wit-bindgen weren't guaranteed to get picked up by whatever wit-bindgen happened to be running exports. This still isn't a great solution because it'll take time to roll out and it'll additionally require that both imports and exports have the async-spawn cargo feature enabled, but it's about the best that can be done for now and at least now there's a panic indicating that a spawned task won't get polled because it's not looked at on the exported side.

Closes #1305

This commit adds hooks in the C ABI portion of this crate to spawn Rust
tasks. This fixes the issue where spawned tasks by any particular
version of `wit-bindgen` weren't guaranteed to get picked up by whatever
`wit-bindgen` happened to be running exports. This still isn't a great
solution because it'll take time to roll out and it'll additionally
require that both imports and exports have the `async-spawn` cargo
feature enabled, but it's about the best that can be done for now and at
least now there's a panic indicating that a spawned task won't get
polled because it's not looked at on the exported side.

Closes bytecodealliance#1305
@alexcrichton
alexcrichton requested a review from dicej September 25, 2026 14:40
Comment on lines +204 to +208
/// Drops and deallocates the provided pointer previously created by a
/// call to the `clone` callback above.
///
/// This must not be called on the `ptr` value within `wasip3_task::ptr` as
/// that's not managed with this lifetime.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment appears to be cut-and-pasted and unrelated to the function it documents.

@alexcrichton
alexcrichton added this pull request to the merge queue Sep 25, 2026
Merged via the queue into bytecodealliance:main with commit f5e1973 Sep 25, 2026
29 checks passed
@alexcrichton
alexcrichton deleted the spawn-across-versions branch September 25, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rust async_support::spawn is not multi-version-safe

2 participants