From 8ef9c6fc5bcfe1b606229a8da024f76b2d5048c1 Mon Sep 17 00:00:00 2001 From: kib Date: Sat, 20 Aug 2016 12:26:44 +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') diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c index 7001311..383aafa 100644 --- a/lib/libthr/thread/thr_exit.c +++ b/lib/libthr/thread/thr_exit.c @@ -151,8 +151,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); } @@ -246,6 +250,8 @@ cleanup: while (curthread->cleanup != NULL) { __pthread_cleanup_pop_imp(1); } + __cxa_thread_call_dtors(); + exit_thread(); } @@ -253,6 +259,7 @@ cleanup: while (curthread->cleanup != NULL) { __pthread_cleanup_pop_imp(1); } + __cxa_thread_call_dtors(); exit_thread(); #endif /* _PTHREAD_FORCED_UNWIND */ -- cgit v1.1