[PATCH] Destructor support for C++11 thread_local variables
Jakub Jelinek
jakub@redhat.com
Fri Oct 12 06:16:00 GMT 2012
On Thu, Oct 11, 2012 at 03:53:40PM -0700, Richard Henderson wrote:
> On 10/11/2012 03:17 PM, Roland McGrath wrote:
> >> One must construct all of the tls variables from a translation unit at
> >> the same time.
> >
> > Is that a semantic requirement? Is there a special technical reason for
> > it, or just "principle of least astonishment" for people who write
> > constructors with side effects?
>
> Semantic requirement of c++11.
Though, I still wonder how is that implementable. Because a TU could have
say 3 thread_local vars with ctors/dtors, and the middle one of them could
call in the constructor some function that accesses thread_local with
ctors/dtors of some other TU, then you have just partially initialized the
current TU and need to initialize another TU (and it is unclear in what
order they need to be destructed).
Jakub
More information about the Libc-alpha
mailing list