summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-11-21 21:41:37 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-11-21 21:41:37 +0000
commit764d26127618c1293d498ba0b8c9f626be521278 (patch)
tree55cb70b74d998b93b6d3112e2ba3bd51bf74d767
parentd5692c713f9bd827b3f01fd7173e423aa39e4966 (diff)
downloadcygnal-764d26127618c1293d498ba0b8c9f626be521278.tar.gz
cygnal-764d26127618c1293d498ba0b8c9f626be521278.tar.bz2
cygnal-764d26127618c1293d498ba0b8c9f626be521278.zip
* init.cc (dll_entry): Revert previous patch. This requires another
solution. * miscfuncs.cc (thread_wrapper): Ditto. * sigproc.cc (exit_thread): Disable sending a signal for synchronization with process exit. Explain why. Keep code in for later inspection, should the problem show up again. (sig_send): Use "tls", rather than "tid" as name for _cygtls arg.
-rw-r--r--winsup/cygwin/ChangeLog10
-rw-r--r--winsup/cygwin/init.cc2
-rw-r--r--winsup/cygwin/miscfuncs.cc2
-rw-r--r--winsup/cygwin/sigproc.cc13
4 files changed, 23 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 17ac09b82..16d836c01 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,13 @@
+2014-11-21 Corinna Vinschen <corinna@vinschen.de>
+
+ * init.cc (dll_entry): Revert previous patch. This requires another
+ solution.
+ * miscfuncs.cc (thread_wrapper): Ditto.
+ * sigproc.cc (exit_thread): Disable sending a signal for synchronization
+ with process exit. Explain why. Keep code in for later inspection,
+ should the problem show up again.
+ (sig_send): Use "tls", rather than "tid" as name for _cygtls arg.
+
2014-11-20 Corinna Vinschen <corinna@vinschen.de>
* init.cc (dll_entry): Call _my_tls.remove with INFINITE wait period
diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc
index f01f35e5f..78e88b94b 100644
--- a/winsup/cygwin/init.cc
+++ b/winsup/cygwin/init.cc
@@ -95,7 +95,7 @@ dll_entry (HANDLE h, DWORD reason, void *static_load)
if (dll_finished_loading
&& (PVOID) &_my_tls > (PVOID) &test_stack_marker
&& _my_tls.isinitialized ())
- _my_tls.remove (INFINITE);
+ _my_tls.remove (0);
break;
}
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index 14ead9152..eee47a53a 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -564,7 +564,7 @@ thread_wrapper (PVOID arg)
cfree (arg);
/* Remove _cygtls from this stack since it won't be used anymore. */
- _my_tls.remove (INFINITE);
+ _my_tls.remove (0);
/* Set stack values in TEB */
PTEB teb = NtCurrentTeb ();
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index f04c01386..c53efccc1 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -451,6 +451,14 @@ exit_thread (DWORD res)
if (no_thread_exit_protect ())
ExitThread (res);
sigfillset (&_my_tls.sigmask); /* No signals wanted */
+
+ /* CV 2014-11-21: Disable the code sending a signal. The problem with
+ this code is that it allows deadlocks under signal-rich multithreading
+ conditions.
+ The original problem reported in 2012 couldn't be reproduced anymore,
+ even disabling this code. Tested on XP 32, Vista 32, W7 32, WOW64, 64,
+ W8.1 WOW64, 64. */
+#if 0
lock_process for_now; /* May block indefinitely when exiting. */
HANDLE h;
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
@@ -469,16 +477,17 @@ exit_thread (DWORD res)
siginfo_t si = {__SIGTHREADEXIT, SI_KERNEL};
si.si_cyg = h;
sig_send (myself_nowait, si, &_my_tls);
+#endif
ExitThread (res);
}
int __reg3
-sig_send (_pinfo *p, int sig, _cygtls *tid)
+sig_send (_pinfo *p, int sig, _cygtls *tls)
{
siginfo_t si = {};
si.si_signo = sig;
si.si_code = SI_KERNEL;
- return sig_send (p, si, tid);
+ return sig_send (p, si, tls);
}
/* Send a signal to another process by raising its signal semaphore.