initThreadPool freezing after call
See original GitHub issueI’m trying to make the basic example with the sum function work
#[wasm_bindgen]
pub fn sum(numbers: &[i32]) -> i32 {
numbers.par_iter().sum()
}
but every time when JS hit the funcion initThreadPool(even with the init function working correctly), he’s freezing, I have tried in two different ways, first
init().then(_ => {
initThreadPool(navigator.hardwareConcurrency).then(_ => {
sum(new Int32Array([1, 2, 3]))
})
})
and
init().then(_ => {
initThreadPool(navigator.hardwareConcurrency);
sum(new Int32Array([1, 2, 3]));
})
but with that last way, I always get that error: “panicked at ‘The global thread pool has not been initialized.: ThreadPoolBuildError { kind: IOError(Error { kind: Unsupported, message: “operation not supported on this platform” }) }’”, and after a few days I still have no idea what it could be
Issue Analytics
- State:
- Created 2 years ago
- Comments:11
Top Results From Across the Web
Fix an Android device that freezes or won't respond
Try the following steps if your phone: Freezes Stops responding Is stuck with the screen on After each step, restart your phone to...
Read more >What To Do if Your Phone Keeps Freezing - Progressive
When a phone freezes can be a hint as to why it's freezing. Try to isolate when the issue occurs so you can...
Read more >c# - App freezes after Dispatcher.Invoke - Stack Overflow
I have this application that freezes when calling the dispatcher.invoke for any control. When i Call the Dispatcher in radiobutton, Grid, ...
Read more >Why is my phone acting sluggish and freezing? - HTC Support
When a smartphone is handling too many processes or the RAM is full, the phone's performance can suffer, causing it to lag, run...
Read more >Crashing, freezing, or unexpectedly restarting troubleshooting
Crashing, freezing, and restarting are usually signs of a software or app problem. This means your device isn't broken, but probably needs some...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ranis-junior Wait a second, so you’re trying to use wasm-bindgen generated code directly from HTML, aka from the main thread? Unfortunately that won’t work due to Wasm limitations intended to avoid blocking the main thread.
Please check the Caveats section of the docs as well as how the demo does it - you must do all the work in a dedicated Worker.
Even if you don’t use Comlink, the minimal example should be more like:
worker.js
:index.html
:It’s surprising that you didn’t see an error message in the Console, both Chrome and Firefox should complain when you’re trying to use Wasm threads from the main browser thread.
Glad it worked!