Skip to content

Update thread and futex APIs to work with Emscripten #78965

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

Merged
merged 2 commits into from
Nov 12, 2020

Conversation

jryans
Copy link
Contributor

@jryans jryans commented Nov 12, 2020

This updates the thread and futex APIs in std to match the APIs exposed by
Emscripten. This allows threads to run on wasm32-unknown-emscripten and the
thread parker to compile without errors related to the missing futex module.

To make use of this, Rust code must be compiled with -C target-feature=atomics
and Emscripten must link with -pthread.

I have confirmed this works well locally when building multithreaded crates.
Attempting to enable std thread tests currently fails for seemingly obscure
reasons and Emscripten is currently disabled in CI, so further work is needed to
have proper test coverage here.

This updates the thread and futex APIs in `std` to match the APIs exposed by
Emscripten. This allows threads to run on `wasm32-unknown-emscripten` and the
thread parker to compile without errors related to the missing `futex` module.

To make use of this, Rust code must be compiled with `-C target-feature=atomics`
and Emscripten must link with `-pthread`.

I have confirmed this works well locally when building multithreaded crates.
Attempting to enable `std` thread tests currently fails for seemingly obscure
reasons and Emscripten is currently disabled in CI, so further work is needed to
have proper test coverage here.
@rust-highfive
Copy link
Contributor

r? @kennytm

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 12, 2020
Copy link
Member

@kennytm kennytm left a comment

Choose a reason for hiding this comment

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

r=me otherwise.

@jryans
Copy link
Contributor Author

jryans commented Nov 12, 2020

@kennytm Thanks for the detailed review, comments should be addressed now.

@kennytm
Copy link
Member

kennytm commented Nov 12, 2020

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 12, 2020

📌 Commit bf3be09 has been approved by kennytm

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 12, 2020
@bors
Copy link
Collaborator

bors commented Nov 12, 2020

⌛ Testing commit bf3be09 with merge 55794e4...

@bors
Copy link
Collaborator

bors commented Nov 12, 2020

☀️ Test successful - checks-actions
Approved by: kennytm
Pushing 55794e4 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 12, 2020
@bors bors merged commit 55794e4 into rust-lang:master Nov 12, 2020
@rustbot rustbot added this to the 1.49.0 milestone Nov 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants