diff --git a/src/library.js b/src/library.js index c60bfed76f3fa..59f530db8f668 100644 --- a/src/library.js +++ b/src/library.js @@ -2078,16 +2078,12 @@ addToLibrary({ // at runtime. $keepRuntimeAlive__deps: ['$runtimeKeepaliveCounter'], $keepRuntimeAlive: () => noExitRuntime || runtimeKeepaliveCounter > 0, -#elif !EXIT_RUNTIME - // When `noExitRuntime` is not include and EXIT_RUNTIME=0 then we know the +#elif !EXIT_RUNTIME && !PTHREADS + // When `noExitRuntime` is not included and EXIT_RUNTIME=0 then we know the // runtime can never exit (i.e. should always be kept alive). - // However for pthreads we always default to allowing the runtime to exit - // otherwise threads never exit and are not joinable. -#if PTHREADS - $keepRuntimeAlive: () => !ENVIRONMENT_IS_PTHREAD, -#else + // However, since pthreads themselves always need to be able to exit we + // have to track `runtimeKeepaliveCounter` in that case. $keepRuntimeAlive: () => true, -#endif #else $keepRuntimeAlive__deps: ['$runtimeKeepaliveCounter'], $keepRuntimeAlive: () => runtimeKeepaliveCounter > 0, diff --git a/test/test_other.py b/test/test_other.py index bd1857ffba167..b1cf9a7bbd5b8 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -13640,8 +13640,12 @@ def test_pthread_icu(self): self.do_other_test('test_pthread_icu.cpp') @node_pthreads - def test_pthread_set_main_loop(self): - self.do_other_test('test_pthread_set_main_loop.c') + @parameterized({ + '': ([],), + 'strict': (['-sSTRICT'],), + }) + def test_pthread_set_main_loop(self, args): + self.do_other_test('test_pthread_set_main_loop.c', emcc_args=args) # unistd tests