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>2011-12-09 10:49:10 +0400
committerChristopher Faylor <me@cgf.cx>2011-12-09 10:49:10 +0400
commite35f1d1655d0bf584d8698af2f0303cc87114261 (patch)
tree2e0398a5dbd85edb1c71301125033c22716a3c2f /winsup/cygwin
parent8714982ceffd3775501059563d1cb33d83ea00ef (diff)
* sigproc.cc (signal_exit): Revert reversion of 2011-12-04 change since,
otherwise, you see hangs when the signal pipe is closed.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/debug.cc3
-rw-r--r--winsup/cygwin/sigproc.cc20
3 files changed, 26 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 507bbc428..28099d78c 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-09 Christopher Faylor <me.cygwin2011@cgf.cx>
+
+ * sigproc.cc (signal_exit): Revert reversion of 2011-12-04 change
+ since, otherwise, you see hangs when the signal pipe is closed.
+
2011-12-08 Christopher Faylor <me.cygwin2011@cgf.cx>
* select.cc (cygwin_select): Fifth time is the charm.
diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc
index 6613dd99c..428bd052a 100644
--- a/winsup/cygwin/debug.cc
+++ b/winsup/cygwin/debug.cc
@@ -221,9 +221,12 @@ close_handle (const char *func, int ln, HANDLE h, const char *name, bool force)
lock_debug here;
if (!mark_closed (func, ln, h, name, force))
return false;
+debug_printf ("here 1");
SetHandleInformation (h, HANDLE_FLAG_PROTECT_FROM_CLOSE, 0);
+debug_printf ("here 2");
ret = CloseHandle (h);
+debug_printf ("here 3, ret %d", ret);
if (!ret)
{
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 8ddc047e4..d9d4bcfed 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -376,10 +376,26 @@ _cygtls::signal_exit (int rc)
{
extern void stackdump (DWORD, int, bool);
+ HANDLE myss = my_sendsig;
my_sendsig = NULL; /* Make no_signals_allowed return true */
- close_my_readsig ();
- SetEvent (signal_arrived); /* Avoid potential deadlock with proc_lock */
+ /* This code used to try to always close my_readsig but it ended up
+ blocking for reasons that people in google think make sense.
+ It's possible that it was blocking because ReadFile was still active
+ but it isn't clear why this only caused random hangs rather than
+ consistent hangs. So, for now at least, avoid closing my_readsig
+ unless this is the signal thread. */
+ if (&_my_tls == _sig_tls)
+ close_my_readsig (); /* Stop any currently executing sig_sends */
+ else
+ {
+ sigpacket sp = {};
+ sp.si.si_signo = __SIGEXIT;
+ DWORD len;
+ /* Write a packet to the wait_sig thread which tells it to exit and
+ close my_readsig. */
+ WriteFile (myss, &sp, sizeof (sp), &len, NULL);
+ }
if (rc == SIGQUIT || rc == SIGABRT)
{