-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Full-featured async support in the web (WASM)? #6178
Comments
I don't really know that much about wasm. Maybe in the future, but not right now. It's also important to distinguish between web wasm and non-web wasm. It makes a difference whether we can block for extended durations of time. |
Thank you!
I am not sure, but it seems that the web workers (which tokio may create) do not block the main thread. |
Right. Ultimately, that just means there are three cases to distinguish between, not two. Wasi and web worker are not really the same in terms of what operations they expose as far as I understand. |
Closing as duplicate of #4827. |
Tokio supports only what it can support without OS APIs that are exposed by, for example, WASI. WEB API doesn't cover anything close to that, so I'd consider it impossible. |
You're right, I've reopened this. |
I'm going to close support for browser wasm as out of scope for Tokio. Please see issue #4827 for other types of wasm. |
I see, thank you all the same! |
Is your feature request related to a problem? Please describe.
Hi, thanks for the helpful async runtime! When working on https://github.com/fzyzcjy/flutter_rust_bridge v2, more specifically the async Rust support, I realize that tokio's async does not have full features on the web.
https://docs.rs/tokio/latest/tokio/#wasm-support says that,
rt
is supported, butrt-multi-thread
is not. However, it seems useful sometimes to leverage multi threads instead of only one thread.There seems already exists ways to utilize multiple threads in WASM. For example, here is a "thread pool" example https://github.com/rustwasm/wasm-bindgen/blob/main/examples/raytrace-parallel/src/pool.rs. In flutter_rust_bridge, we also already utilize that code (with citations, surely) for a slightly more general purposed worker pool: https://github.com/fzyzcjy/flutter_rust_bridge/blob/6f3fa295d192a3945aab6c63ab6b533dc2aef2a9/frb_rust/src/wasm_bindgen_src/pool.rs. Memory seems also possible to be shared between workers via SharedArrayBuffer.
Therefore, I wonder whether tokio's async system will be full-featured in WASM in the future? Thanks!
Describe the solution you'd like
(see above)
Describe alternatives you've considered
(see above)
Additional context
(see above)
The text was updated successfully, but these errors were encountered: