smol-rs / async-io

Async I/O and timers
Apache License 2.0
457 stars 67 forks source link

Enable usage of timers on WASM #89

Open notgull opened 2 years ago

notgull commented 2 years ago

WASM targets don't support Async and probably won't until WASI reaches a more stable point. However, since parking is usable on WASM thanks to atomics, it may be desirable to use the Timer implementation.

My suggestion is to add two new features: io and timers. They compose as such:

This would be a breaking change.

taiki-e commented 2 years ago

I'm not sure if we need to introduce such a breaking change to support WASM. Currently, async-io fails to compile on WASM anyway, so I think just disabling some APIs in WASM is not a problem.

notgull commented 2 years ago

That's probably the best way of going about this. I'll rearrange the PR I wrote to use OS flags instead of feature flags.

notgull commented 1 year ago

A few points of note I discovered while implementing this:

notgull commented 9 months ago

Not relevant for now