This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Destructor support for C++11 thread_local variables


I really hope there will be a way to use this from C, e.g.

__thread type x;
static void __attribute__((thread_destructor (x))) foo (type *x_ptr) { ... }

I'm pretty disinclined to add features to libc whose only possible use
is via C++.

Who says preventing DSO unloading is the right semantics?  The obvious
analog to global destructors is to run them all on dlclose.  That's
difficult to do if the semantics are that the destructor runs on the
thread owning the variable.  (They'd be running inside a signal
handler or something scary like that.)  It's not so hard if the
destructor takes the specific object pointer as a parameter and might
run on any thread.  What is supposed to happen when you dlopen an
object defining thread_local variables with constructors when there
are already multiple threads?


Thanks,
Roland


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]