Call thread finalizers on exit()

While we don't call POSIX thread key destructors from exit(), we do need
to call these, since C++ uses it for TLS object destructors.

See #1076
This commit is contained in:
Justine Tunney 2024-01-08 11:45:02 -08:00
parent 07db3004d6
commit 81ce2e4cbc
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
5 changed files with 56 additions and 22 deletions

View file

@ -73,13 +73,6 @@ void OnMainThreadExit(void *arg) {
_Exit((long)arg);
}
TEST(__cxa_thread_atexit, exit_wontInvokeThreadDestructors) {
SPAWN(fork);
__cxa_thread_atexit(OnMainThreadExit, (void *)123L, 0);
exit(0);
EXITS(0);
}
TEST(__cxa_thread_atexit, pthread_exit_willInvokeThreadDestructors) {
SPAWN(fork);
__cxa_thread_atexit(OnMainThreadExit, (void *)123L, 0);