all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Interruptible wait_for_termination
@ 2012-11-10 18:43 Eli Zaretskii
  2012-11-10 21:31 ` Paul Eggert
  2012-11-12  5:13 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2012-11-10 18:43 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-11-12 17:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-10 18:43 Interruptible wait_for_termination Eli Zaretskii
2012-11-10 21:31 ` 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.