From: Eli Zaretskii <eliz@gnu.org>
To: emacs-devel@gnu.org
Subject: Interruptible wait_for_termination
Date: Sat, 10 Nov 2012 20:43:55 +0200 [thread overview]
Message-ID: <838va9xpqs.fsf@gnu.org> (raw)
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
next reply other threads:[~2012-11-10 18:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-10 18:43 Eli Zaretskii [this message]
2012-11-10 21:31 ` Interruptible wait_for_termination Paul Eggert
2012-11-11 3:48 ` Eli Zaretskii
2012-11-11 6:36 ` Paul Eggert
2012-11-11 12:28 ` Andreas Schwab
2012-11-11 16:30 ` Eli Zaretskii
2012-11-11 19:00 ` Paul Eggert
2012-11-12 5:13 ` Lars Magne Ingebrigtsen
2012-11-12 15:52 ` Eli Zaretskii
2012-11-12 17:31 ` Lars Magne Ingebrigtsen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=838va9xpqs.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).