From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 57764385C411; Fri, 19 Nov 2021 17:40:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 57764385C411 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_3-branch] Cygwin: sigproc: Do not send signal to myself if exiting. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/cygwin-3_3-branch X-Git-Oldrev: f9f06a4607adb9dfcc4fbf88ed2ba0653943677d X-Git-Newrev: 67bf89c4cea3d41139328fd2d1494129f68fbbb1 Message-Id: <20211119174054.57764385C411@sourceware.org> Date: Fri, 19 Nov 2021 17:40:54 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2021 17:40:54 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=67bf89c4cea3d41139328fd2d1494129f68fbbb1 commit 67bf89c4cea3d41139328fd2d1494129f68fbbb1 Author: Takashi Yano Date: Sat Nov 20 02:32:12 2021 +0900 Cygwin: sigproc: Do not send signal to myself if exiting. - 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 int main() {return getchar();} /*---- End ----*/ 4) Run "tcsh -c ./a.exe" 5) Hit Ctrl-C. Diff: --- winsup/cygwin/sigproc.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index dff797915..fde41a9f6 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -603,6 +603,11 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) its_me = false; } + /* Do not send signal to myself if exiting, which will be + ignored in wait_sig thread. */ + if (its_me && exit_state > ES_EXIT_STARTING && si.si_signo > 0) + goto out; + if (its_me) sendsig = my_sendsig; else