Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/lib/libpthread.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,18 @@ var LibraryPThread = {
#endif

// If this message is intended to a recipient that is not the main
// thread, forward it to the target thread.
if (d.targetThread && d.targetThread != _pthread_self()) {
// thread, forward it to the target thread. This is currently only
// used by `CMD_CHECK_MAILBOX`.
if (d.targetThread) {
#if ASSERTIONS
// pthreads should not be relaying messages to themselves.
assert(d.targetThread != _pthread_self());
#endif
var targetWorker = PThread.pthreads[d.targetThread];
if (targetWorker) {
targetWorker.postMessage(d, d.transferList);
} else {
err(`worker sent message (${cmd}) to pthread (${d.targetThread}) that no longer exists`);
}
#if ASSERTIONS
if (!targetWorker) err(`worker sent message (${cmd}) to pthread (${d.targetThread}) that no longer exists`);
#endif
targetWorker?.postMessage(d);
return;
}

Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_minimal_pthreads.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 7110,
"a.out.js.gz": 3524,
"a.out.js": 7012,
"a.out.js.gz": 3472,
"a.out.nodebug.wasm": 19037,
"a.out.nodebug.wasm.gz": 8787,
"total": 26147,
"total_gz": 12311,
"total": 26049,
"total_gz": 12259,
"sent": [
"a (memory)",
"b (exit)",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_minimal_pthreads_memgrowth.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 7518,
"a.out.js.gz": 3728,
"a.out.js": 7420,
"a.out.js.gz": 3672,
"a.out.nodebug.wasm": 19038,
"a.out.nodebug.wasm.gz": 8788,
"total": 26556,
"total_gz": 12516,
"total": 26458,
"total_gz": 12460,
"sent": [
"a (memory)",
"b (exit)",
Expand Down
Loading