diff --git a/src/lib/libpthread.js b/src/lib/libpthread.js index 9d9e90523393b..17cf6f40681b3 100644 --- a/src/lib/libpthread.js +++ b/src/lib/libpthread.js @@ -545,6 +545,7 @@ var LibraryPThread = { worker.workerID = PThread.nextWorkerID++; #endif PThread.unusedWorkers.push(worker); + return worker; }, getNewWorker() { @@ -573,8 +574,8 @@ var LibraryPThread = { #endif #endif // PTHREAD_POOL_SIZE_STRICT #if PTHREAD_POOL_SIZE_STRICT < 2 || ENVIRONMENT_MAY_BE_NODE - PThread.allocateUnusedWorker(); - PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0]); + var newWorker = PThread.allocateUnusedWorker(); + PThread.loadWasmModuleToWorker(newWorker); #endif } return PThread.unusedWorkers.pop(); diff --git a/test/codesize/test_codesize_minimal_pthreads.json b/test/codesize/test_codesize_minimal_pthreads.json index 5e9412e1955ff..851b17340ee79 100644 --- a/test/codesize/test_codesize_minimal_pthreads.json +++ b/test/codesize/test_codesize_minimal_pthreads.json @@ -1,10 +1,10 @@ { - "a.out.js": 7121, - "a.out.js.gz": 3528, + "a.out.js": 7110, + "a.out.js.gz": 3524, "a.out.nodebug.wasm": 19037, "a.out.nodebug.wasm.gz": 8787, - "total": 26158, - "total_gz": 12315, + "total": 26147, + "total_gz": 12311, "sent": [ "a (memory)", "b (exit)", diff --git a/test/codesize/test_codesize_minimal_pthreads_memgrowth.json b/test/codesize/test_codesize_minimal_pthreads_memgrowth.json index cd4dd103bb6c3..9dcfca60775f6 100644 --- a/test/codesize/test_codesize_minimal_pthreads_memgrowth.json +++ b/test/codesize/test_codesize_minimal_pthreads_memgrowth.json @@ -1,10 +1,10 @@ { - "a.out.js": 7529, - "a.out.js.gz": 3732, + "a.out.js": 7518, + "a.out.js.gz": 3728, "a.out.nodebug.wasm": 19038, "a.out.nodebug.wasm.gz": 8788, - "total": 26567, - "total_gz": 12520, + "total": 26556, + "total_gz": 12516, "sent": [ "a (memory)", "b (exit)",