-
Notifications
You must be signed in to change notification settings - Fork 156
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
[WIP] wasm32 backend #99
Conversation
…smol compile by making none of it compile ;-)
The last commit sketches a possible structure out. I've created a new 'WebExecutor' and I've replaced the innards of Task with a PhantomData on wasm, and removed everything but the ability to forget it. I'm not sure how I feel about this. I don't personally use the task handles, so I'm not sure if this is likely to be problematic for some users. |
Thank you for starting work on this! Quick question: how are we going to implement timers and task spawning? What crate does provide that? (sorry, not super familiar with web) We can implement task cancelation by using something like https://docs.rs/futures/0.3.5/futures/future/fn.abortable.html |
Hiya, So timers are pretty easy, they can just be the equivalent of
I had another play a few hours ago and my gut feeling is that we should actually do something similar to the rest of smol, except probably in the first instance it should be limited to the thread local executor because we can't really get the full benefit of multithreading. I actually tried to just reuse your thread local executor, but it depends on io_event, which looks not so easily disentangled (for a start, it wants Async...). So the current avenue I'm looking at involves async-task and essentially replicating the local executor, without the dependence on the IO stuff. I have no idea what I'm doing :) |
Oh, and it's web-sys that has all the relevant browser apis, but the moment you have to actually pass data across the boundary it gets a bit tedious. |
Oh, one more thing I should mention, I have been taking inspiration (although not too much of it) from wasm-bindgen-futures. |
Thank you for elaborating! I am currently working on untangling the reactor from the executor so this will soon become much easier. |
Maybe we can use WebWorker for multithreading tasks? |
Hey @jjl whats the status on this? |
@kwek20 I haven't done anything on it in a while, nor am I likely to in the rest of this year. i expect the status of the wasm backend makes some of this a bit easier now than it did when i started, if you were interested in picking up where i left off. Although given smol has changed so much since then, not sure how much of it you'd want to salvage. |
I've thrown together an example harness to be able to test it (based on druid's) and i've made smol compile by effectively commenting out all the code with
cfg
.Will eventually close #87.
I'll start actually implementing it now, but I thought it would be good to open a PR for tracking since a few people seem interested in contributing.