Skip to content

Commit bf7c1ea

Browse files
authored
Allow Node workers to be re-used (#12963)
- posixtest.test_pthread_create_11_1 seems to work again - Explicitly link test_pthread* tests with EXIT_RUNTIME
1 parent 7192647 commit bf7c1ea

File tree

3 files changed

+5
-27
lines changed

3 files changed

+5
-27
lines changed

src/library_pthread.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,11 +1055,6 @@ var LibraryPThread = {
10551055
if (!ENVIRONMENT_IS_PTHREAD) _exit(status);
10561056
else PThread.threadExit(status);
10571057
// pthread_exit is marked noReturn, so we must not return from it.
1058-
if (ENVIRONMENT_IS_NODE) {
1059-
// exit the pthread properly on node, as a normal JS exception will halt
1060-
// the entire application.
1061-
process.exit(status);
1062-
}
10631058
throw 'unwind';
10641059
},
10651060

tests/test_core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8246,6 +8246,7 @@ def test_pthread_cxx_threads(self):
82468246
def test_pthread_create_pool(self):
82478247
# with a pool, we can synchronously depend on workers being available
82488248
self.set_setting('PTHREAD_POOL_SIZE', '2')
8249+
self.set_setting('EXIT_RUNTIME')
82498250
self.emcc_args += ['-DALLOW_SYNC']
82508251
self.do_run_in_out_file_test('core/pthread/create.cpp')
82518252

@@ -8261,12 +8262,14 @@ def test_pthread_create_proxy(self):
82618262
def test_pthread_create_embind_stack_check(self):
82628263
# embind should work with stack overflow checks (see #12356)
82638264
self.set_setting('STACK_OVERFLOW_CHECK', 2)
8265+
self.set_setting('EXIT_RUNTIME')
82648266
self.emcc_args += ['--bind']
82658267
self.do_run_in_out_file_test('core/pthread/create.cpp')
82668268

82678269
@node_pthreads
82688270
def test_pthread_exceptions(self):
82698271
self.set_setting('PTHREAD_POOL_SIZE', '2')
8272+
self.set_setting('EXIT_RUNTIME')
82708273
self.emcc_args += ['-fexceptions']
82718274
self.do_run_in_out_file_test('core/pthread/exceptions.cpp')
82728275

tests/test_posixtest.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def get_pthread_tests():
136136
}
137137

138138
# Mark certain tests as flaky, which may sometimes fail.
139-
# TODO invesigate these tests.
139+
# TODO investigate these tests.
140140
flaky = {
141141
'test_pthread_cond_signal_1_1': 'flaky: https://github.com/emscripten-core/emscripten/issues/13283',
142142
}
@@ -145,27 +145,7 @@ def get_pthread_tests():
145145
disabled = {
146146
**unsupported,
147147
**flaky,
148-
'test_pthread_create_11_1': 'never returns',
149-
'test_pthread_barrier_wait_2_1': 'never returns',
150148
'test_pthread_attr_setscope_5_1': 'internally skipped (PTS_UNTESTED)',
151-
'test_pthread_create_5_1': 'never returns',
152-
'test_pthread_exit_1_2': 'never returns',
153-
'test_pthread_exit_2_2': 'never returns',
154-
'test_pthread_exit_3_2': 'never returns',
155-
'test_pthread_exit_4_1': 'never returns',
156-
'test_pthread_getcpuclockid_1_1': 'never returns',
157-
'test_pthread_key_create_1_2': 'never returns',
158-
'test_pthread_rwlock_rdlock_1_1': 'fails with "main: Unexpected thread state"',
159-
'test_pthread_rwlock_timedrdlock_1_1': 'fails with "main: Unexpected thread state"',
160-
'test_pthread_rwlock_timedrdlock_3_1': 'fails with "main: Unexpected thread state"',
161-
'test_pthread_rwlock_timedrdlock_5_1': 'fails with "main: Unexpected thread state"',
162-
'test_pthread_rwlock_timedwrlock_1_1': 'fails with "main: Unexpected thread state"',
163-
'test_pthread_rwlock_timedwrlock_3_1': 'fails with "main: Unexpected thread state"',
164-
'test_pthread_rwlock_timedwrlock_5_1': 'fails with "main: Unexpected thread state"',
165-
'test_pthread_rwlock_wrlock_1_1': 'fails with "main: Unexpected thread state"',
166-
'test_pthread_rwlock_trywrlock_1_1': 'fails with "main: Unexpected thread state"',
167-
'test_pthread_spin_destroy_3_1': 'never returns',
168-
'test_pthread_spin_init_4_1': 'never returns',
169149
}
170150

171151

@@ -180,7 +160,7 @@ def f(self):
180160
'-Wno-int-conversion',
181161
'-sUSE_PTHREADS',
182162
'-sEXIT_RUNTIME',
183-
'-sTOTAL_MEMORY=268435456',
163+
'-sTOTAL_MEMORY=256mb',
184164
'-sPTHREAD_POOL_SIZE=40']
185165
if browser:
186166
# Only are only needed for browser tests of the was btest

0 commit comments

Comments
 (0)