Skip to content
Merged
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
6 changes: 1 addition & 5 deletions src/lib/libpthread.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,7 @@ var LibraryPThread = {
// If this message is intended to a recipient that is not the main
// 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
if (d.targetThread && d.targetThread != _pthread_self()) {
var targetWorker = PThread.pthreads[d.targetThread];
#if ASSERTIONS
if (!targetWorker) err(`worker sent message (${cmd}) to pthread (${d.targetThread}) that no longer exists`);
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": 6945,
"a.out.js.gz": 3424,
"a.out.js": 6955,
"a.out.js.gz": 3431,
"a.out.nodebug.wasm": 19108,
"a.out.nodebug.wasm.gz": 8824,
"total": 26053,
"total_gz": 12248,
"total": 26063,
"total_gz": 12255,
"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": 7379,
"a.out.js.gz": 3639,
"a.out.js": 7389,
"a.out.js.gz": 3647,
"a.out.nodebug.wasm": 19109,
"a.out.nodebug.wasm.gz": 8826,
"total": 26488,
"total_gz": 12465,
"total": 26498,
"total_gz": 12473,
"sent": [
"a (memory)",
"b (exit)",
Expand Down
6 changes: 6 additions & 0 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3954,6 +3954,12 @@ def test_gauge_available_memory(self, args):
def test_pthread_run_on_main_thread(self):
self.btest_exit('pthread/test_pthread_run_on_main_thread.c', cflags=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE'])

# Test that proxying operations work when Atomics.waitAsync is disabled,
# forcing the waitAsyncPolyfilled/postMessage fallback path.
def test_pthread_no_waitasync(self):
create_file('pre.js', 'delete Atomics.waitAsync;\n')
self.btest_exit('pthread/test_pthread_proxy_to_pthread.c', cflags=['-O3', '-pthread', '-sPROXY_TO_PTHREAD', '-sASSERTIONS', '--pre-js=pre.js'])

# Test how a lot of back-to-back called proxying operations behave.
def test_pthread_run_on_main_thread_flood(self):
self.btest_exit('pthread/test_pthread_run_on_main_thread_flood.c', cflags=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE'])
Expand Down