The process that receives many SIGSTOP/SIGCONT signals sometimes hangs
on exit in sig_dispatch_pending(). This patch skips processing signals
in call_signal_handler() when exit_state > ES_EXIT_STARTING to avoid
that situation.

Addresses: https://cygwin.com/pipermail/cygwin/2025-February/257473.html
Fixes: d243e51ef1d3 ("Cygwin: signal: Fix deadlock between main thread and sig 
thread")
Reported-by: Christian Franke <christian.fra...@t-online.de>
Reviewed-by:
Signed-off-by: Takashi Yano <takashi.y...@nifty.ne.jp>
---
 winsup/cygwin/exceptions.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 45c71cbdf..759f89dca 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1675,7 +1675,7 @@ _cygtls::call_signal_handler ()
   while (1)
     {
       lock ();
-      if (!current_sig)
+      if (!current_sig || exit_state > ES_EXIT_STARTING)
        {
          unlock ();
          break;
-- 
2.45.1

Reply via email to