Previously, the retry flag was always set when pending_signal::pending() was called. However, if the queue is empty sig thread tries to flush the queue even though it is not necessary. With this patch, the retry flag is set only if the queue is not empty.
Addresses: https://cygwin.com/pipermail/cygwin/2024-November/256744.html Fixes: 5e31c80e4e8d ("(pending_signals::pending): Force an additional loop through wait_sig by setting retry whenever this function is called.") Reported-by: Christian Franke <christian.fra...@t-online.de> Reviewed-by: Signed-off-by: Takashi Yano <takashi.y...@nifty.ne.jp> --- winsup/cygwin/sigproc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index fc4360951..c46b1492a 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -110,7 +110,7 @@ class pending_signals public: void add (sigpacket&); - bool pending () {retry = true; return !!start.next;} + bool pending () {retry = !!start.next; return retry;} void clear (int sig) {sigs[sig].si.si_signo = 0;} void clear (_cygtls *tls); friend void sig_dispatch_pending (bool); -- 2.45.1