* cygthread.cc (cygthread::cygthread): Close another race.

This commit is contained in:
Christopher Faylor 2002-08-11 19:31:24 +00:00
parent 3cb62bd614
commit 5ffec1d16d
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2002-08-11 Christopher Faylor <cgf@redhat.com>
* cygthread.cc (cygthread::cygthread): Close another race.
2002-08-11 Christopher Faylor <cgf@redhat.com> 2002-08-11 Christopher Faylor <cgf@redhat.com>
* assert.cc (__assert): Call debugger on assertion failure if * assert.cc (__assert): Call debugger on assertion failure if

View File

@ -123,8 +123,15 @@ cygthread::cygthread (LPTHREAD_START_ROUTINE start, LPVOID param,
api_fatal ("name should never be NULL"); api_fatal ("name should never be NULL");
#endif #endif
thread_printf ("name %s, id %p", name, id); thread_printf ("name %s, id %p", name, id);
while (ResumeThread (h) == 0) while (!h || ResumeThread (h) != 1)
#ifndef DEBUGGING
Sleep (0); Sleep (0);
#else
{
thread_printf ("waiting for %s<%p> to become active", __name, h);
Sleep (0);
}
#endif
__name = name; /* Need to set after thread has woken up to __name = name; /* Need to set after thread has woken up to
ensure that it won't be cleared by exiting ensure that it won't be cleared by exiting
thread. */ thread. */