Skip to content

coop-threads: Handle thread creation failure - #896

Merged
alexcrichton merged 1 commit into
WebAssembly:mainfrom
alexcrichton:handle-spawn-failure
Nov 2, 2026
Merged

alexcrichton merged 1 commit into
WebAssembly:mainfrom
alexcrichton:handle-spawn-failure

Conversation

@alexcrichton

Copy link
Copy Markdown
Collaborator

This commit is an adjustment to pthread_create on wasip3 with coop threads enabled, specifically to account for
WebAssembly/component-model#760 where thread.new-indirect may fail. The handling of errors here was also adjusted where -1 is now the only failure code recognized from thread.new-indirect and limiting the bounds of the created thread tid is validated only in successful spawns. Additionally the return value isn't returned directly from the function, but instead the EAGAIN symbolic constant is returned.

This commit is an adjustment to `pthread_create` on wasip3 with coop
threads enabled, specifically to account for
WebAssembly/component-model#760 where `thread.new-indirect` may fail.
The handling of errors here was also adjusted where -1 is now the only
failure code recognized from `thread.new-indirect` and limiting the
bounds of the created thread tid is validated only in successful spawns.
Additionally the return value isn't returned directly from the function,
but instead the `EAGAIN` symbolic constant is returned.
@alexcrichton
alexcrichton requested a review from dicej November 2, 2026 20:12
@alexcrichton
alexcrichton merged commit d861187 into WebAssembly:main Nov 2, 2026
36 checks passed
@alexcrichton
alexcrichton deleted the handle-spawn-failure branch November 2, 2026 21:37
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.

2 participants