From 7e8bea05408ed1f02197d608373ffc7177e60d80 Mon Sep 17 00:00:00 2001 From: kib Date: Sat, 20 Aug 2016 11:58:23 +0000 Subject: MFC r303795: Add __cxa_thread_atexit(3) API implementation. --- lib/libthr/thread/thr_exit.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/libthr/thread/thr_exit.c') 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 */ -- cgit v1.1