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

Add explicit web support #77

Merged
merged 2 commits into from
Aug 26, 2023
Merged

Add explicit web support #77

merged 2 commits into from
Aug 26, 2023

Conversation

notgull
Copy link
Member

@notgull notgull commented Aug 24, 2023

This commit adds WASM compilation support to this crate. The main thing is that the wait() family of APIs are removed in WASM mode, as blocking is not allowed in WASM.

In addition, tests are added to CI to support WASM.

@taiki-e
Copy link
Collaborator

taiki-e commented Aug 24, 2023

Thanks!

  • Is this also needed for wasi-threads?
  • Because of MSRV, we can use target_family = "wasm" instead of any(target_arch = "wasm32", target_arch = "wasm64"). (target_family = "wasm" requires Rust 1.54)
  • The changes on tests can be simplified in the same way as smol-rs/fastrand@83f08b4.

This commit adds WASM compilation support to this crate. The main thing
is that the wait() family of APIs are removed in WASM mode, as blocking
is not allowed in WASM.

In addition, tests are added to CI to support WASM.

Signed-off-by: John Nunley <dev@notgull.net>
- Simplify WASM tests
- Simplify WASM selection

Signed-off-by: John Nunley <dev@notgull.net>
@notgull
Copy link
Member Author

notgull commented Aug 26, 2023

* Is this also needed for wasi-threads?

I don't think so. I was mostly thinking about browsers for this change, but I see no reason why it also wouldn't work for wasi-threads. I realize that I disabled the wait() family of functions for now. Once WASM atomics are stable I'll re-enable them.

Aside from that, I've fixed the issues you brought up.

@notgull notgull merged commit c278371 into master Aug 26, 2023
9 checks passed
@notgull notgull deleted the notgull/web branch August 26, 2023 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants