aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-10-14 03:32:00 +0000
committerChristopher Faylor <me@cgf.cx>2002-10-14 03:32:00 +0000
commitbe48889fed3264c770dca91ddaae9d925c961213 (patch)
treee8b51dd5c6c8bdbe87c1a8228b487787ebc33644
parent2c4849b5130d0639f2227ad4e35c64409cc170cc (diff)
downloadnewlib-github/unlabeled-1.13.4.zip
newlib-github/unlabeled-1.13.4.tar.gz
newlib-github/unlabeled-1.13.4.tar.bz2
* spawn.cc (spawn_guts): Fix so that cygthread::terminate is *really* calledgithub/unlabeled-1.13.4unlabeled-1.13.4
only for exec. * cygthread.cc (cygthread::stub): Don't zero __name here. That introduces a race.
-rw-r--r--winsup/cygwin/cygthread.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc
index ec217b7..ce64a74 100644
--- a/winsup/cygwin/cygthread.cc
+++ b/winsup/cygwin/cygthread.cc
@@ -44,21 +44,26 @@ cygthread::stub (VOID *arg)
}
while (1)
{
- if (!info->func || initialized < 0)
- ExitThread (0);
+ if (!info->__name)
+ system_printf ("errnoneous thread activation");
+ else
+ {
+ if (!info->func || initialized < 0)
+ ExitThread (0);
- /* Cygwin threads should not call ExitThread directly */
- info->func (info->arg == cygself ? info : info->arg);
- /* ...so the above should always return */
+ /* Cygwin threads should not call ExitThread directly */
+ info->func (info->arg == cygself ? info : info->arg);
+ /* ...so the above should always return */
#ifdef DEBUGGING
- info->func = NULL; // catch erroneous activation
+ info->func = NULL; // catch erroneous activation
#endif
- SetEvent (info->ev);
- info->__name = NULL;
+ SetEvent (info->ev);
+ }
switch (WaitForSingleObject (info->thread_sync, INFINITE))
{
case WAIT_OBJECT_0:
+ // ResetEvent (info->thread_sync);
continue;
default:
api_fatal ("WFSO failed, %E");