[newlib-cygwin/cygwin-3_5-branch] Cygwin: signal: Drop unnecessary queue flush

Corinna Vinschen corinna@sourceware.org
Fri Dec 6 10:47:07 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e1b6996e7bfacac3f0b93bbf9f1c40a7c734eeb3

commit e1b6996e7bfacac3f0b93bbf9f1c40a7c734eeb3
Author:     Takashi Yano <takashi.yano@nifty.ne.jp>
AuthorDate: Mon Nov 25 20:55:44 2024 +0900
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Fri Dec 6 11:30:19 2024 +0100

    Cygwin: signal: Drop unnecessary queue flush
    
    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.Franke@t-online.de>
    Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
    Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
    (cherry picked from commit 57ce5f1e0bf4a6fef7173b2549edc4f2090dd0e7)

Diff:
---
 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 ecf79bc71283..618cc45565c6 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);


More information about the Cygwin-cvs mailing list