summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_exit.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2016-08-20 11:58:23 +0000
committerkib <kib@FreeBSD.org>2016-08-20 11:58:23 +0000
commit7e8bea05408ed1f02197d608373ffc7177e60d80 (patch)
treebb35a7941f2cabd9c18542aa9b2c05ea142afd47 /lib/libthr/thread/thr_exit.c
parent1fab140878f2c0fbe5801a4a7bb0549d15f23343 (diff)
downloadFreeBSD-src-7e8bea05408ed1f02197d608373ffc7177e60d80.zip
FreeBSD-src-7e8bea05408ed1f02197d608373ffc7177e60d80.tar.gz
MFC r303795:
Add __cxa_thread_atexit(3) API implementation.
Diffstat (limited to 'lib/libthr/thread/thr_exit.c')
-rw-r--r--lib/libthr/thread/thr_exit.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c
index 3ead7ff..a2d67de 100644
--- a/lib/libthr/thread/thr_exit.c
+++ b/lib/libthr/thread/thr_exit.c
@@ -153,8 +153,12 @@ thread_unwind_stop(int version, _Unwind_Action actions,
__pthread_cleanup_pop_imp(1);
}
- if (done)
+ if (done) {
+ /* Tell libc that it should call non-trivial TLS dtors. */
+ __cxa_thread_call_dtors();
+
exit_thread(); /* Never return! */
+ }
return (_URC_NO_REASON);
}
@@ -258,6 +262,8 @@ cleanup:
while (curthread->cleanup != NULL) {
__pthread_cleanup_pop_imp(1);
}
+ __cxa_thread_call_dtors();
+
exit_thread();
}
@@ -265,6 +271,7 @@ cleanup:
while (curthread->cleanup != NULL) {
__pthread_cleanup_pop_imp(1);
}
+ __cxa_thread_call_dtors();
exit_thread();
#endif /* _PTHREAD_FORCED_UNWIND */
OpenPOWER on IntegriCloud