Skip to content
Draft
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: 0 additions & 6 deletions src/lib/libpthread.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,6 @@ var LibraryPThread = {
#endif
#if expectToReceiveOnModule('onAbort')
'onAbort',
#endif
#if expectToReceiveOnModule('print')
'print',
#endif
#if expectToReceiveOnModule('printErr')
'printErr',
#endif
];
for (var handler of knownHandlers) {
Expand Down
5 changes: 1 addition & 4 deletions src/runtime_pthread.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ if (ENVIRONMENT_IS_PTHREAD) {
// Use `const` here to ensure that the variable is scoped only to
// that iteration, allowing safe reference from a closure.
for (const handler of msgData.handlers) {
// The the main module has a handler for a certain even, but no
// The main module has a handler for a certain event, but no
// handler exists on the pthread worker, then proxy that handler
// back to the main thread.
if (!Module[handler] || Module[handler].proxy) {
Expand All @@ -95,9 +95,6 @@ if (ENVIRONMENT_IS_PTHREAD) {
#endif
postMessage({ cmd: 'callHandler', handler, args: args });
}
// Rebind the out / err handlers if needed
if (handler == 'print') out = Module[handler];
if (handler == 'printErr') err = Module[handler];
}
#if RUNTIME_DEBUG
else dbg(`worker: using thread-local handler: ${handler}`);
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_minimal_pthreads.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 7659,
"a.out.js.gz": 3776,
"a.out.js": 7613,
"a.out.js.gz": 3753,
"a.out.nodebug.wasm": 19592,
"a.out.nodebug.wasm.gz": 9060,
"total": 27251,
"total_gz": 12836,
"total": 27205,
"total_gz": 12813,
"sent": [
"a (memory)",
"b (emscripten_get_now)",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_minimal_pthreads_memgrowth.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 8086,
"a.out.js.gz": 3977,
"a.out.js": 8040,
"a.out.js.gz": 3953,
"a.out.nodebug.wasm": 19593,
"a.out.nodebug.wasm.gz": 9061,
"total": 27679,
"total_gz": 13038,
"total": 27633,
"total_gz": 13014,
"sent": [
"a (memory)",
"b (emscripten_get_now)",
Expand Down
36 changes: 0 additions & 36 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -7235,42 +7235,6 @@ def test_modularize_instantiation_error(self):
self.assertContained('failed to asynchronously prepare wasm', output)
self.assertContained('got error: RuntimeError: Aborted', output)

@crossplatform
@node_pthreads
@flaky('https://github.com/emscripten-core/emscripten/issues/19683')
# The flakiness of this test is very high on macOS so just disable it
# completely.
@no_mac('https://github.com/emscripten-core/emscripten/issues/19683')
def test_pthread_print_override_modularize(self):
self.set_setting('EXPORT_NAME', 'Test')
self.set_setting('PROXY_TO_PTHREAD')
self.set_setting('EXIT_RUNTIME')
self.set_setting('MODULARIZE')
create_file('main.c', '''
#include <emscripten/console.h>

int main() {
emscripten_out("hello, world!");
return 0;
}
''')
create_file('main.js', '''
const Test = require('./test.js');

async function main() {
await Test({
// world -> earth
print: (text) => console.log(text.replace('world', 'earth'))
});
}
main();
''')

self.emcc('main.c', output_filename='test.js')
output = self.run_js('main.js')
self.assertNotContained('hello, world!', output)
self.assertContained('hello, earth!', output)

def test_define_modularize(self):
self.run_process([EMCC, test_file('hello_world.c'), '-sMODULARIZE', '-sASSERTIONS=0'])
src = 'var module = 0; ' + read_file('a.out.js')
Expand Down