diff options
author | Eli Zaretskii <eliz@gnu.org> | 2021-01-23 12:51:57 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2021-01-23 12:51:57 +0200 |
commit | 8d8e1dfd05fd79859e8206de0e89329b0d862ce1 (patch) | |
tree | d139a9e29be2dc615cc00ed3936a007578207371 /src/process.c | |
parent | cc98d0bf5225c281f91152aa838c4cb093df52e9 (diff) | |
download | emacs-8d8e1dfd05fd79859e8206de0e89329b0d862ce1.tar.gz emacs-8d8e1dfd05fd79859e8206de0e89329b0d862ce1.tar.bz2 emacs-8d8e1dfd05fd79859e8206de0e89329b0d862ce1.zip |
Clean up the recently added self-pipe mechanism for WINDOWSNT
* src/process.c (child_signal_init, child_signal_read)
(child_signal_notify): #ifdef away on WINDOWSNT.
Diffstat (limited to 'src/process.c')
-rw-r--r-- | src/process.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/process.c b/src/process.c index 57105982c15..697d9b0b19b 100644 --- a/src/process.c +++ b/src/process.c @@ -290,7 +290,10 @@ static int child_signal_read_fd = -1; status changes. */ static int child_signal_write_fd = -1; static void child_signal_init (void); +#ifndef WINDOWSNT +/* FIXME: This is never used, on all platforms. */ static void child_signal_read (int, void *); +#endif static void child_signal_notify (void); /* Indexed by descriptor, gives the process (if any) for that descriptor. */ @@ -7148,8 +7151,18 @@ process has been transmitted to the serial port. */) have the same process ID. To avoid a deadlock when receiving SIGCHLD while - `wait_reading_process_output' is in `pselect', the SIGCHLD handler - will notify the `pselect' using a pipe. */ + 'wait_reading_process_output' is in 'pselect', the SIGCHLD handler + will notify the `pselect' using a self-pipe. The deadlock could + occur if SIGCHLD is delivered outside of the 'pselect' call, in + which case 'pselect' will not be interrupted by the signal, and + will therefore wait on the process's output descriptor for the + output that will never come. + + WINDOWSNT doesn't need this facility because its 'pselect' + emulation (see 'sys_select' in w32proc.c) waits on a subprocess + handle, which becomes signaled when the process exits, and also + because that emulation delays the delivery of the simulated SIGCHLD + until all the output from the subprocess has been consumed. */ /* Set up `child_signal_read_fd' and `child_signal_write_fd'. */ @@ -7159,6 +7172,7 @@ child_signal_init (void) /* Either both are initialized, or both are uninitialized. */ eassert ((child_signal_read_fd < 0) == (child_signal_write_fd < 0)); +#ifndef WINDOWSNT if (0 <= child_signal_read_fd) return; /* already done */ @@ -7185,8 +7199,10 @@ child_signal_init (void) fd_callback_info[fds[0]].flags &= ~KEYBOARD_FD; child_signal_read_fd = fds[0]; child_signal_write_fd = fds[1]; +#endif /* !WINDOWSNT */ } +#ifndef WINDOWSNT /* Consume a process status change. */ static void @@ -7198,6 +7214,7 @@ child_signal_read (int fd, void *data) if (emacs_read (fd, &dummy, 1) < 0) emacs_perror ("reading from child signal FD"); } +#endif /* !WINDOWSNT */ /* Notify `wait_reading_process_output' of a process status change. */ @@ -7205,11 +7222,13 @@ child_signal_read (int fd, void *data) static void child_signal_notify (void) { +#ifndef WINDOWSNT int fd = child_signal_write_fd; eassert (0 <= fd); char dummy = 0; if (emacs_write (fd, &dummy, 1) != 1) emacs_perror ("writing to child signal FD"); +#endif } /* LIB_CHILD_HANDLER is a SIGCHLD handler that Emacs calls while doing |