* cygthread.cc (cygthread::stub): Don't zero __name here. That introduces a

race.
This commit is contained in:
Christopher Faylor 2002-10-14 02:37:49 +00:00
parent 5c2b46f4a8
commit a7a5d0ba37
2 changed files with 18 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2002-10-13 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::stub): Don't zero __name here. That
introduces a race.
2002-10-13 Christopher Faylor <cgf@redhat.com> 2002-10-13 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number. * include/cygwin/version.h: Bump DLL minor number.

View File

@ -44,21 +44,26 @@ cygthread::stub (VOID *arg)
} }
while (1) while (1)
{ {
if (!info->func || initialized < 0) if (!info->__name)
ExitThread (0); system_printf ("errnoneous thread activation");
else
{
if (!info->func || initialized < 0)
ExitThread (0);
/* Cygwin threads should not call ExitThread directly */ /* Cygwin threads should not call ExitThread directly */
info->func (info->arg == cygself ? info : info->arg); info->func (info->arg == cygself ? info : info->arg);
/* ...so the above should always return */ /* ...so the above should always return */
#ifdef DEBUGGING #ifdef DEBUGGING
info->func = NULL; // catch erroneous activation info->func = NULL; // catch erroneous activation
#endif #endif
SetEvent (info->ev); SetEvent (info->ev);
info->__name = NULL; }
switch (WaitForSingleObject (info->thread_sync, INFINITE)) switch (WaitForSingleObject (info->thread_sync, INFINITE))
{ {
case WAIT_OBJECT_0: case WAIT_OBJECT_0:
// ResetEvent (info->thread_sync);
continue; continue;
default: default:
api_fatal ("WFSO failed, %E"); api_fatal ("WFSO failed, %E");