Hi,
I am using both pthreads and wasm workers, and I see more workers being
created than necessary.
The reason seems to be the following:
PThread.init checks for ENVIRONMENT_IS_PTHREAD first, in all other cases
Pthread.initMainThread is called. To me it looks like there should be an
additional check for
ENVIRONMENT_IS_WASM_WORKER:
init: function() {
PThread.debugInit();
if (ENVIRONMENT_IS_PTHREAD || ENVIRONMENT_IS_WASM_WORKER) {
PThread.initWorker();
} else {
PThread.initMainThread();
}
},
The current init function leads to initMainThread being called for each
wasm worker, which in turn will call PThread.init to allocate the number of
workers specified by PTHREAD_POOL_SIZE multiple times..
It seems to work correctly with the suggested change, however, I am not
familiar enough with the internals of Emscripten to make a judgement.
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/emscripten-discuss/c77af58d-f543-4a98-80c5-1a855240e6e2n%40googlegroups.com.