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

Jason Merrill jason@redhat.com
Fri Oct 12 14:26:00 GMT 2012


On 10/11/2012 07:13 PM, Roland McGrath wrote:
> Then why do we have __attribute__ ((destructor)) when there is already
> atexit?

Because there is no run-time penalty for that, whereas there is a 
run-time penalty for thread_local variables to support dynamic 
init/destruction even for variables that don't actually need it.

> But it's IMHO
> inexcusable that a patch to implement this deep in the bowels of glibc
> after the C++ standard and the G++ implementation have already been baked
> is the first we are hearing about the subject.

I think you overestimate how baked they are.  :)

My initial implementation, which is the first implementation of this 
language feature, just went into the compiler and is still somewhat in 
flux.  If there are problems with the specification, they can be fixed 
in a DR.  Jakub suggested that we could get better semantics through 
glibc integration, so we're trying to do that.

Jason



More information about the Libc-alpha mailing list