This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Thread-local support for non-POD data objects
- From: Siddhesh Poyarekar <siddhesh dot poyarekar at gmail dot com>
- To: Rich Felker <dalias at aerifal dot cx>
- Cc: Siddhesh Poyarekar <siddhesh at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Sat, 13 Jul 2013 01:57:14 +0530
- Subject: Re: Thread-local support for non-POD data objects
- References: <20130712172128 dot GC32671 at spoyarek dot pnq dot redhat dot com> <20130712201036 dot GD29800 at brightrain dot aerifal dot cx>
On 13 July 2013 01:40, Rich Felker <dalias@aerifal.cx> wrote:
> Why is this needed in libc at all? My understanding is that the
> thread-local ctors run when the C++ thread-creation function is used,
> because pthread_create is called with a C++-implementation-internal
> start function wrapping the application-provided start function. If
> this is correct, then the start function provided by C++ could simply
> use pthread_cleanup_push to install a cleanup handler that runs the
> dtors, and run them manually with pthread_cleanup_pop(1) if the
> application's start function returns. This would cover both
> cancellation and pthread_exit or equivalent.
>
> Am I missing some obvious reason this would not work?
I had documented this when I wrote the patch:
http://sourceware.org/glibc/wiki/Destructor%20support%20for%20thread_local%20variables
Siddhesh
--
http://siddhesh.in