[PATCH] pthread_key patch
Mon Jul 8 00:38:00 GMT 2002
On Fri, 5 Jul 2002, Christopher Faylor wrote:
> On Fri, Jul 05, 2002 at 08:50:21AM +0200, Thomas Pfaff wrote:
> >If somebody is interested why if find this patch neccessary with a posix
> >threaded gcc could read
> Can you summarize why you need to explicitly run destructors on process
> detach? It seems like this should happen automatically anyway. I assume
> that you're accessing thread-local storage on thread detach, so that's
> why you need to do things then. Process detach on the other hand...
This is pthread feature, i am not calling any of my own destructors.
Pthread keys can have an additional destructor function that is called
when the thread is terminated. The 2.95.3 gcc use this feature to free the
thread specific exception context.
In the actual pthread code these destructor functions are called in
pthread_exit, but this works only for threads that have been created
pthread_create, but not with CreateThread. IMHO cygwin should support both
The reason why i have added it to PROCESS_DETACH too is that the last
terminating thread is detached in PROCESS_DETACH, not in THREAD_DETACH.
More information about the Cygwin-patches