-
Notifications
You must be signed in to change notification settings - Fork 744
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
Wasm32-wasi target support #1576
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rjzak we're not going to accept this as is. Poll
needs to have mutable access on Windows as it can only handle a single poll call at a time. Furthermore we don't want to force everyone to use an Arc
.
Could you please explain why you need this change? "Wasm improvements" are not really clear.
src/poll.rs
Outdated
}) | ||
} | ||
} | ||
|
||
/// Create a separate `Registry` which can be used to register | ||
/// `event::Source`s. | ||
#[cfg(target_os = "wasi")] | ||
pub fn registry(&self) -> Arc<Registry> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not going to accept a different public API based on the compile target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a work-around for try_clone()
not being available to the wasi registry here https://github.com/tokio-rs/tokio/blob/2d90ef5861029a9cfc8e89c05ddc65ed754bb77b/tokio/src/io/driver/mod.rs#L133 requires https://github.com/tokio-rs/mio/blob/master/src/poll.rs#L638, but try_clone()
isn't working on the underlying object with Wasi, that's a compiler error.
@Thomasdezeeuw I certainly wouldn't want this PR accepted as-is, as the test application here https://github.com/rjzak/tokio-echo-test compiles to Wasm but doesn't work. I thought that by sharing the code I have so far, I could receive some feedback and pointers. |
Ping @rjzak. |
@Thomasdezeeuw I'm still working on it! |
@Thomasdezeeuw I have Axum & Tokio working on WebAssembly. |
Maybe you can put the |
@Thomasdezeeuw @carllerche I moved the Line in question: Line 378 in 6312041
Error:
Otherwise, formatting issues and the previously API difference between platforms has been resolved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two small nits, LGTM otherwise.
Signed-off-by: Richard Zak <richard@profian.com>
Thanks @rjzak. |
Thank you! |
I'm working on getting Tokio working on Rust, and some changes were needed for Mio.
Companion to tokio-rs/tokio#4716
Signed-off-by: Richard Zak richard@profian.com