From 4bcb985bd2764a099b7cc51cb5c2ffbbb7383124 Mon Sep 17 00:00:00 2001 From: cgf Date: Mon, 21 Nov 2011 19:13:29 +0000 Subject: [PATCH] * sigproc.cc (remove_proc): Don't do busy loop when execing since thread could have been terminated prior to setting flag. * signal.cc (sigwaitinfo): Zero event before closing to signal other threads that it is no longer available. --- winsup/cygwin/ChangeLog | 8 ++++++++ winsup/cygwin/signal.cc | 2 ++ winsup/cygwin/sigproc.cc | 5 +++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index f9505df4a8..e7278c8575 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2011-11-21 Christopher Faylor + + * sigproc.cc (remove_proc): Don't do busy loop when execing since + thread could have been terminated prior to setting flag. + + * signal.cc (sigwaitinfo): Zero event before closing to signal other + threads that it is no longer available. + 2011-11-18 Corinna Vinschen * shared.cc (get_shared_parent_dir): Use global shared_parent_dir diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 32cbfe9d34..9b45fee1bc 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -608,6 +608,8 @@ sigwaitinfo (const sigset_t *set, siginfo_t *info) __seterrno (); res = -1; } + + _my_tls.event = NULL; CloseHandle (h); sigproc_printf ("returning signal %d", res); return res; diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 663abfb5c2..a48bd43fd6 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -1106,8 +1106,9 @@ remove_proc (int ci) moving it or it may become confused. The chances are very high that the proc_waiter thread has already done this by the time we get here. */ - while (!procs[nprocs].waiter_ready) - yield (); + if (!have_execed) + while (!procs[nprocs].waiter_ready) + yield (); procs[ci] = procs[nprocs]; } return 0; -- 2.11.0