diff --git a/emcc.py b/emcc.py index 3bd697fbe960d..37b560e8a6fc6 100644 --- a/emcc.py +++ b/emcc.py @@ -3747,6 +3747,10 @@ def consume_arg_file(): settings.PTHREADS = 1 # Also set the legacy setting name, in case use JS code depends on it. settings.USE_PTHREADS = 1 + elif arg == '-no-pthread': + settings.PTHREADS = 0 + # Also set the legacy setting name, in case use JS code depends on it. + settings.USE_PTHREADS = 0 elif arg == '-pthreads': exit_with_error('unrecognized command-line option `-pthreads`; did you mean `-pthread`?') elif arg in ('-fno-diagnostics-color', '-fdiagnostics-color=never'): diff --git a/test/test_other.py b/test/test_other.py index f8756509eaf9f..17c1b77d8e78c 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -14159,3 +14159,8 @@ def test_embind_no_duplicate_symbols(self): create_file('a.cpp', '#include ') create_file('b.cpp', '#include ') self.run_process([EMXX, '-std=c++23', '-lembind', 'a.cpp', 'b.cpp']) + + def test_no_pthread(self): + self.do_runf('hello_world.c', emcc_args=['-pthread', '-no-pthread']) + self.assertExists('hello_world.js') + self.assertNotExists('hello_world.worker.js')