This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: [PATCH] pthread_key patch
On Mon, Jul 08, 2002 at 09:38:07AM +0200, Thomas Pfaff wrote:
>
>
>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
>> >http://cygwin.com/ml/cygwin-patches/2002-q2/msg00214.html
>>
>> 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
>ways.
>
>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.
Ok. Got it. I thought that you were using standard c++ constructors.
I apologize for not checking more closely.
I'll let Robert comment on the efficacy of this patch.
cgf