emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Interruptible wait_for_termination


From: Eli Zaretskii
Subject: Interruptible wait_for_termination
Date: Sat, 10 Nov 2012 20:43:55 +0200

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]