Skip to content

Commit b44cb92

Browse files
authored
libpthread.js: Return result from allocateUnusedWorker. NFC (#27015)
1 parent 3eb2d79 commit b44cb92

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

src/lib/libpthread.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ var LibraryPThread = {
545545
worker.workerID = PThread.nextWorkerID++;
546546
#endif
547547
PThread.unusedWorkers.push(worker);
548+
return worker;
548549
},
549550

550551
getNewWorker() {
@@ -573,8 +574,8 @@ var LibraryPThread = {
573574
#endif
574575
#endif // PTHREAD_POOL_SIZE_STRICT
575576
#if PTHREAD_POOL_SIZE_STRICT < 2 || ENVIRONMENT_MAY_BE_NODE
576-
PThread.allocateUnusedWorker();
577-
PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0]);
577+
var newWorker = PThread.allocateUnusedWorker();
578+
PThread.loadWasmModuleToWorker(newWorker);
578579
#endif
579580
}
580581
return PThread.unusedWorkers.pop();

test/codesize/test_codesize_minimal_pthreads.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"a.out.js": 7121,
3-
"a.out.js.gz": 3528,
2+
"a.out.js": 7110,
3+
"a.out.js.gz": 3524,
44
"a.out.nodebug.wasm": 19037,
55
"a.out.nodebug.wasm.gz": 8787,
6-
"total": 26158,
7-
"total_gz": 12315,
6+
"total": 26147,
7+
"total_gz": 12311,
88
"sent": [
99
"a (memory)",
1010
"b (exit)",

test/codesize/test_codesize_minimal_pthreads_memgrowth.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"a.out.js": 7529,
3-
"a.out.js.gz": 3732,
2+
"a.out.js": 7518,
3+
"a.out.js.gz": 3728,
44
"a.out.nodebug.wasm": 19038,
55
"a.out.nodebug.wasm.gz": 8788,
6-
"total": 26567,
7-
"total_gz": 12520,
6+
"total": 26556,
7+
"total_gz": 12516,
88
"sent": [
99
"a (memory)",
1010
"b (exit)",

0 commit comments

Comments
 (0)