From ba384f6ed9275f3966505f2375b56d169e3dc588 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Mon, 18 Feb 2013 19:08:21 +0530 Subject: C++11 thread_local destructors support This feature is specifically for the C++ compiler to offload calling thread_local object destructors on thread program exit, to glibc. This is to overcome the possible complication of destructors of thread_local objects getting called after the DSO in which they're defined is unloaded by the dynamic linker. The DSO is marked as 'unloadable' if it has a constructed thread_local object and marked as 'unloadable' again when all the constructed thread_local objects defined in it are destroyed. --- stdlib/exit.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'stdlib/exit.c') diff --git a/stdlib/exit.c b/stdlib/exit.c index e9a2139f4e..2e86caa2d4 100644 --- a/stdlib/exit.c +++ b/stdlib/exit.c @@ -33,6 +33,9 @@ attribute_hidden __run_exit_handlers (int status, struct exit_function_list **listp, bool run_list_atexit) { + /* First, call the TLS destructors. */ + __call_tls_dtors (); + /* We do it this way to handle recursive calls to exit () made by the functions registered with `atexit' and `on_exit'. We call everyone on the list and use the status value in the last -- cgit v1.2.3