-
-
Notifications
You must be signed in to change notification settings - Fork 951
Description
Just an issue to track the status on the threading support.
Emscripten has Pthreads support via SharedArrayBuffer
capability in browsers. The later got disabled due to Spectre etc vulnerabilities, however,
- a few days ago there was an announcement that threading should work again with WASM in Chrome 70 (https://developers.google.com/web/updates/2018/10/wasm-threads)
SharedArrayBuffer
is available in Firefox since 57 via a config option, but that is disabled by default. The switch to enabled by default can be tracked in https://bugzilla.mozilla.org/show_bug.cgi?id=1477743
There also has been some activity in emscripten on this subject lately.
Because of,
If code is compiled with -s USE_PTHREADS=1 and the current browser does not support multithreading, then an exception will be thrown at page load time. It is not possible to build one binary that would be able to leverage multithreading when available and fall back to single threaded when not. For such backwards compatibility, two separate builds must be done, one with -s USE_PTHREADS=1 and the other with -s USE_PTHREADS=0.
(taken from emscripten docs)
I imagine we won't be able to do much until both Firefox and Chrome have it enabled by default in a stable release. Still it might be worth trying to make it work in a WIP PR to see what are the difficulties that could arise. Opening this issue for future reference.
This would also very partially address #144