4 ms·
You may want to file a bug on Go - I believe goroutines should work, including swapping between them. The code is emitted in a form that allows that (switch-in-
by azakai 5y ago
You may want to file a bug on Go - I believe goroutines should work, including swapping between them. The code is emitted in a form that allows that (switch-in-a-loop pattern).
Another thing you can try is TinyGo, whch uses Asyncify (a general wasm transformation to allow blocking) for goroutines,
https://twitter.com/TinyGolang/status/1461364896197578759 https://twitter.com/TinyGolang/status/1461364896197578759
Doom3 uses Asyncify in some parts of the event loop, for similar reasons (blocking code). I'm not sure if LibreOffice does as well, but it might.
- Abishek_Muthian 5y agoYou're right, I think I should file a bug. The Go library I need(ebiten) isn't compatible with TinyGo, I did try it for the reason you mentioned and to reduce size. > Doom3 uses Asyncify in some parts of the event loop, for similar reasons (blocking code). I'm not sure if LibreOffice does as well, but it might. Thanks! That's what I wanted to know, So it's certainly possible to write asynchronous code using C++ and Rust.
- azakai 5y agoYes, async code in wasm is definitely possible. See for example here: https://web.dev/asyncify/ https://web.dev/asyncify/ It does have some overhead atm, which a new spec (stack switching) will remove eventually.