From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Interruptible wait_for_termination Date: Sat, 10 Nov 2012 20:43:55 +0200 Message-ID: <838va9xpqs.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1352573072 16274 80.91.229.3 (10 Nov 2012 18:44:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 10 Nov 2012 18:44:32 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 10 19:44:43 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TXG2t-0000e0-3m for ged-emacs-devel@m.gmane.org; Sat, 10 Nov 2012 19:44:43 +0100 Original-Received: from localhost ([::1]:60134 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TXG2j-0006q5-58 for ged-emacs-devel@m.gmane.org; Sat, 10 Nov 2012 13:44:33 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TXG2e-0006nJ-L3 for emacs-devel@gnu.org; Sat, 10 Nov 2012 13:44:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TXG2b-00089o-Ix for emacs-devel@gnu.org; Sat, 10 Nov 2012 13:44:28 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:37342) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TXG2b-00089E-8j for emacs-devel@gnu.org; Sat, 10 Nov 2012 13:44:25 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MDA00A00BZ5C800@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Sat, 10 Nov 2012 20:43:46 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MDA00AHKC0Y3970@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Sat, 10 Nov 2012 20:43:46 +0200 (IST) X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.172 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:154804 Archived-At: The function wait_for_termination_1 can be "interruptible" if called with its second argument non-zero. But what it does is this: while (1) { int status; int wait_result = waitpid (pid, &status, 0); if (wait_result < 0) { if (errno != EINTR) break; } else { record_child_status_change (wait_result, status); break; } if (interruptible) QUIT; } What I don't understand here is how can this be "interruptible" when the process specified by PID did not yet exit, and the call to waitpid blocks. It seems that the only way to interrupt that blocking call is to deliver a signal to Emacs, either SIGINT or some other signal that would interrupt waitpid. IOW, just C-g will _not_ break the above loop (except on a TTY, where C-g generates a SIGINT). So can someone please explain how exactly does a user interrupt this "interruptible" waiting, if, say, the called process never exits? I'm asking because I'd like to make the w32 emulation of waitpid behave in the same way. It currently checks for QUIT internally, while it waits for the process to exit, but I'm not sure this is identical to the Posix behavior. TIA