Skip to content

Implement timed waits for synchronization primitives - #821

Merged
alexcrichton merged 4 commits into
WebAssembly:mainfrom
alexcrichton:wasip3-wait-timeouts
Jul 14, 2026
Merged

alexcrichton merged 4 commits into
WebAssembly:mainfrom
alexcrichton:wasip3-wait-timeouts

Conversation

@alexcrichton

Copy link
Copy Markdown
Collaborator

This commit goes through coop threads for wasip3 and adds support for timed waits to all the various primitives. Everything previously returned some form of error when a timeout was specified, and now the implementations should all be filled in. Notably the main entrypoint function, __waitlist_wait_on, now has a timeout parameter which internally is handled as necessary.

The implementation of waiting with a timeout requires creating a waitable-set, a unit future, and a subtask waiting for the timeout specified. With these blended together it's possible to wait on either of the events happening and then process the result as it comes in.

Closes #806

This commit goes through coop threads for wasip3 and adds support for
timed waits to all the various primitives. Everything previously
returned some form of error when a timeout was specified, and now the
implementations should all be filled in. Notably the main entrypoint
function, `__waitlist_wait_on`, now has a timeout parameter which
internally is handled as necessary.

The implementation of waiting with a timeout requires creating a
waitable-set, a unit future, and a subtask waiting for the timeout
specified. With these blended together it's possible to wait on either
of the events happening and then process the result as it comes in.

Closes WebAssembly#806
@alexcrichton

Copy link
Copy Markdown
Collaborator Author

r? @TartanLlama

@alexcrichton
alexcrichton enabled auto-merge (squash) July 14, 2026 16:06
@alexcrichton
alexcrichton merged commit fb6557b into WebAssembly:main Jul 14, 2026
35 checks passed
@alexcrichton
alexcrichton deleted the wasip3-wait-timeouts branch July 14, 2026 16:17
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.

coop-threads: Improve handling of timeouts

2 participants