Skip to content

Commit c06ebb0

Browse files
authored
Fix the worker id in the pthread name is always 1 (#23809)
Change `PThread.nextWorkerID` self-increment code location, to fix the worker id in the pthread name is always the same value.
1 parent f3cdd7c commit c06ebb0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/lib/libpthread.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,6 @@ var LibraryPThread = {
352352
}
353353
}
354354

355-
#if ASSERTIONS
356-
worker.workerID = PThread.nextWorkerID++;
357-
#endif
358-
359355
// Ask the new worker to load up the Emscripten-compiled page. This is a heavy operation.
360356
worker.postMessage({
361357
cmd: 'load',
@@ -464,6 +460,9 @@ var LibraryPThread = {
464460
#endif
465461
worker = new Worker(pthreadMainJs, {{{ pthreadWorkerOptions }}});
466462
#endif // EXPORT_ES6
463+
#if ASSERTIONS
464+
worker.workerID = PThread.nextWorkerID++;
465+
#endif
467466
PThread.unusedWorkers.push(worker);
468467
},
469468

0 commit comments

Comments
 (0)