public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-patches@cygwin.com
Subject: [PATCH] Cygwin: sigproc: Do not send signal to myself if exiting.
Date: Fri, 19 Nov 2021 20:50:43 +0900	[thread overview]
Message-ID: <20211119115043.356-1-takashi.yano@nifty.ne.jp> (raw)

- This patch fixes the issue that process sometimes hangs for 60
  seconds with the following scenario.
    1) Open command prompt.
    2) Run "c:\cygwin64\bin\bash -l"
    3) Compipe the following source with mingw compiler.
       /*--- Begin ---*/
       #include <stdio.h>
       int main() {return getchar();}
       /*---- End ----*/
    3) Run "tcsh -c ./a.exe"
    4) Hit Ctrl-C.
---
 winsup/cygwin/sigproc.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 97211edcf..9160dd160 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -603,6 +603,10 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls)
       its_me = false;
     }
 
+  /* Do not send signal to myself if exiting. */
+  if (its_me && exit_state > ES_EXIT_STARTING && si.si_signo > 0)
+    goto out;
+
   if (its_me)
     sendsig = my_sendsig;
   else
-- 
2.33.0


             reply	other threads:[~2021-11-19 11:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 11:50 Takashi Yano [this message]
2021-11-19 15:51 ` Corinna Vinschen
2021-11-19 15:53   ` Corinna Vinschen
2021-11-19 17:14     ` Takashi Yano
2021-11-19 17:22       ` Corinna Vinschen
2021-11-19 18:14         ` Takashi Yano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211119115043.356-1-takashi.yano@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).