Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix thread parking on WebAssembly #7041

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

surban
Copy link
Contributor

@surban surban commented Dec 16, 2024

On WebAssembly the notification state was not checked before sleeping and thus wrongfully ignored.

Additionally this refines the check whether threads are available on a particular WebAssembly target.

Motivation

Bug #7036

Solution

Fixes #7036

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-time Module: tokio/time T-wasm Topic: Web Assembly labels Dec 16, 2024
@Darksonn
Copy link
Contributor

Taking rust-lang/rust#134389 (comment) into account, I don't see how this changes anything at all?

@surban
Copy link
Contributor Author

surban commented Dec 18, 2024

Taking rust-lang/rust#134389 (comment) into account, I don't see how this changes anything at all?

The problem was that self.state was not checked before going the sleep. Thus if a self-sent wakeup notification was pending, the thread would go to sleep anyway.

I have updated this PR accordingly. It should now work with and without the Rust std PR.

On WebAssembly the notification state was not checked
before sleeping and thus wrongfully ignored.

Additionally this refines the check whether threads are
available on a particular WebAssembly target.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-time Module: tokio/time T-wasm Topic: Web Assembly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using timeout hangs a program on wasm32-wasip1
2 participants