Don't mark a thread as joinable when it calls exit() #15105
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The previous behavior was that ExitStatus was thrown which ends up
calling emscripten_thread_exit and marking the current thread as
joinable.
This this bug was masking several failures in the posixtest suite
which have always be failing but were not being recognised as such.
Note that we have to use the message queue rather than postMessage
to deliver the exitProcess message since postMessage will not interrupt
the main thread if its blocking on pthread_join.
Modify the existing test so that it fails if pthead_join even returns.
The tests that were passing before are basically of the form:
Such a program would return 0 without this fix.
Fixes: #14993