Closed
Description
Our build hardcodes -s PTHREAD_POOL_SIZE=2
. The docs indicate that this could be a javascript expression instead.
From #68232 (comment)
The docs indicate that PTHREAD_POOL_SIZE can be an integer or a javascript expression. navigator.hardwareConcurrency might be a better default.
Emscripten has some built in detection when the thread pool is exhausted. PTHREAD_POOL_SIZE_STRICT by default warns when the thread pool is exhausted. It can also be adjusted to error (PTHREAD_POOL_SIZE_STRICT=2) or do nothing (PTHREAD_POOL_SIZE_STRICT=0).
If we use navigator.hardwareConcurrency we need to make sure we have fallbacks if it ends up being a garbage number, since it seems an obvious target for anti-fingerprinting measures (i.e. making it a lie)