diff --git a/winsup/cygwin/release/3.5.6 b/winsup/cygwin/release/3.5.6 new file mode 100644 index 0000000000..643d58e585 --- /dev/null +++ b/winsup/cygwin/release/3.5.6 @@ -0,0 +1,5 @@ +Fixes: +------ + +- Fix zsh hang at startup. + Addresses: https://cygwin.com/pipermail/cygwin/2024-December/256954.html diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index cf43aa9335..c2985277fc 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -751,10 +751,14 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) res = WriteFile (sendsig, leader, packsize, &nb, NULL); if (!res || packsize == nb) break; - if (cygwait (NULL, 10, cw_sig_eintr) == WAIT_SIGNALED) + if (cygwait (NULL, 10, cw_sig_eintr) == WAIT_SIGNALED + && pack.si.si_signo != __SIGFLUSHFAST) _my_tls.call_signal_handler (); res = 0; } + /* Re-assert signal_arrived which has been cleared in cygwait(). */ + if (_my_tls.sig) + _my_tls.set_signal_arrived (); if (!res) { @@ -785,7 +789,16 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) if (wait_for_completion) { sigproc_printf ("Waiting for pack.wakeup %p", pack.wakeup); - rc = cygwait (pack.wakeup, WSSC); + do + { + rc = cygwait (pack.wakeup, WSSC, cw_sig_eintr); + if (rc == WAIT_SIGNALED && pack.si.si_signo != __SIGFLUSHFAST) + _my_tls.call_signal_handler (); + } + while (rc != WAIT_OBJECT_0 && rc != WAIT_TIMEOUT); + /* Re-assert signal_arrived which has been cleared in cygwait(). */ + if (_my_tls.sig) + _my_tls.set_signal_arrived (); ForceCloseHandle (pack.wakeup); } else @@ -806,9 +819,6 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) rc = -1; } - if (wait_for_completion && si.si_signo != __SIGFLUSHFAST) - _my_tls.call_signal_handler (); - out: if (communing && rc) {