This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: Recent changes in pthread_create
- From: Christopher Faylor <cgf-no-personal-reply-please at cygwin dot com>
- To: cygwin-patches at cygwin dot com
- Date: Wed, 21 Apr 2004 10:44:57 -0400
- Subject: Re: Recent changes in pthread_create
- References: <18588.1082531891@www4.gmx.net>
- Reply-to: cygwin-patches at cygwin dot com
On Wed, Apr 21, 2004 at 09:18:11AM +0200, Thomas Pfaff wrote:
>Date: Thu, 18 Apr 2002 12:11:26 +0200
>[...]
>2. The InterlockedIncrement (&MT_INTERFACE->threadcount) in
> __pthread_create is misplaced. If the newly created thread terminates
> fast enough the threadcount will be decremented before it was
> incremented, which will result in an exit from __pthread_exit instead
> of an ExitThread.
>[... ]
>
>Same thing will now happen again after your change from CREATE_SUSPENDED to
>0 in CreateThread.
This was not just a simple change of CREATE_SUSPENDED to 0.
I moved the mutex lock to prevent the thread from terminating before
pthread::create exits.