Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-09-15 20:06:18 +0400
committerChristopher Faylor <me@cgf.cx>2005-09-15 20:06:18 +0400
commita3a9aac72d82414427d0f020b74a12c26905426c (patch)
tree06bba46608f636528f3bd00896fe90b92999c85a
parentc4ec3e76b9437d454ea72cd1b30340094b077e69 (diff)
* sigproc.cc (wait_sig): Reorganize exit case so that ExitProcess is always
called, since that is the intent of sending a __SIGEXIT. Wait forever for main thread to go away since, presumably, the main thread told us it was going away.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/sigproc.cc32
2 files changed, 27 insertions, 12 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index e1536d00f..2ab99a577 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2005-09-15 Christopher Faylor <cgf@timesys.com>
+
+ * sigproc.cc (wait_sig): Reorganize exit case so that ExitProcess is
+ always called, since that is the intent of sending a __SIGEXIT. Wait
+ forever for main thread to go away since, presumably, the main thread
+ told us it was going away.
+
2005-09-14 Christopher Faylor <cgf@timesys.com>
* spawn.cc (av::fixup): Avoid breaking out of the wrong "loop".
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index d8fc2d36c..ede777fb8 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -1125,19 +1125,27 @@ wait_sig (VOID *self)
break;
}
- my_sendsig = NULL;
- DWORD res = WaitForSingleObject (hMainThread, 10000);
+ HANDLE h = hMainThread;
+ my_sendsig = hMainThread = NULL;
+ DWORD res = h ? WAIT_OBJECT_0 : WaitForSingleObject (h, INFINITE);
- if (res != WAIT_OBJECT_0)
- sigproc_printf ("wait for main thread returned %d", res);
- else
+ DWORD exitcode = 1;
+
+ myself.release ();
+ if (res == WAIT_OBJECT_0)
{
- DWORD exitcode = 1;
- myself.release ();
- sigproc_printf ("calling ExitProcess, exitcode %p", exitcode);
- GetExitCodeThread (hMainThread, &exitcode);
- ExitProcess (exitcode);
+ GetExitCodeThread (h, &exitcode);
+#ifdef DEBUGGING
+ hMainThread = INVALID_HANDLE_VALUE;
+#endif
+ } else {
+#ifdef DEBUGGING
+ console_printf ("wait for main thread %p returned %d", h, res);
+#else
+ debug_printf ("wait for main thread %p returned %d", h, res);
+#endif
}
- sigproc_printf ("exiting thread");
- ExitThread (0);
+
+ sigproc_printf ("calling ExitProcess, exitcode %p", exitcode);
+ ExitProcess (exitcode);
}