diff options
| author | Kim F. Storm | 2007-03-29 21:24:38 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2007-03-29 21:24:38 +0000 |
| commit | 4740825c2f5fbf8e33889ee718cbe227401f7494 (patch) | |
| tree | e722bd321f07c38ed2505d6344b5d29ed0e95fbb /src/process.c | |
| parent | 1acc2cac84ac2aba49e0d202a667fe06187dd69b (diff) | |
| download | emacs-4740825c2f5fbf8e33889ee718cbe227401f7494.tar.gz emacs-4740825c2f5fbf8e33889ee718cbe227401f7494.zip | |
(wait_reading_process_output) [HAVE_PTYS]:
When EIO happens, clear channel from descriptor masks before raising
SIGCHLD signal to avoid busy loop between read and sigchld_handler.
(sigchld_handler): Remove sleep (2007-03-11 & 2007-03-26 changes).
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/process.c b/src/process.c index 14535eb6e1e..f012b2c058d 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -4817,8 +4817,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, | |||
| 4817 | subprocess termination and SIGCHLD. */ | 4817 | subprocess termination and SIGCHLD. */ |
| 4818 | else if (nread == 0 && !NETCONN_P (proc)) | 4818 | else if (nread == 0 && !NETCONN_P (proc)) |
| 4819 | ; | 4819 | ; |
| 4820 | #endif /* O_NDELAY */ | 4820 | #endif /* O_NDELAY */ |
| 4821 | #endif /* O_NONBLOCK */ | 4821 | #endif /* O_NONBLOCK */ |
| 4822 | #ifdef HAVE_PTYS | 4822 | #ifdef HAVE_PTYS |
| 4823 | /* On some OSs with ptys, when the process on one end of | 4823 | /* On some OSs with ptys, when the process on one end of |
| 4824 | a pty exits, the other end gets an error reading with | 4824 | a pty exits, the other end gets an error reading with |
| @@ -4829,11 +4829,17 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, | |||
| 4829 | get a SIGCHLD). | 4829 | get a SIGCHLD). |
| 4830 | 4830 | ||
| 4831 | However, it has been known to happen that the SIGCHLD | 4831 | However, it has been known to happen that the SIGCHLD |
| 4832 | got lost. So raise the signl again just in case. | 4832 | got lost. So raise the signal again just in case. |
| 4833 | It can't hurt. */ | 4833 | It can't hurt. */ |
| 4834 | else if (nread == -1 && errno == EIO) | 4834 | else if (nread == -1 && errno == EIO) |
| 4835 | kill (getpid (), SIGCHLD); | 4835 | { |
| 4836 | #endif /* HAVE_PTYS */ | 4836 | /* Clear the descriptor now, so we only raise the signal once. */ |
| 4837 | FD_CLR (channel, &input_wait_mask); | ||
| 4838 | FD_CLR (channel, &non_keyboard_wait_mask); | ||
| 4839 | |||
| 4840 | kill (getpid (), SIGCHLD); | ||
| 4841 | } | ||
| 4842 | #endif /* HAVE_PTYS */ | ||
| 4837 | /* If we can detect process termination, don't consider the process | 4843 | /* If we can detect process termination, don't consider the process |
| 4838 | gone just because its pipe is closed. */ | 4844 | gone just because its pipe is closed. */ |
| 4839 | #ifdef SIGCHLD | 4845 | #ifdef SIGCHLD |
| @@ -6514,11 +6520,6 @@ sigchld_handler (signo) | |||
| 6514 | /* Keep trying to get a status until we get a definitive result. */ | 6520 | /* Keep trying to get a status until we get a definitive result. */ |
| 6515 | do | 6521 | do |
| 6516 | { | 6522 | { |
| 6517 | /* For some reason, this sleep() prevents Emacs from sending | ||
| 6518 | loadavg to 5-8(!) for ~10 seconds. | ||
| 6519 | See http://thread.gmane.org/gmane.emacs.devel/67722 or | ||
| 6520 | http://www.google.com/search?q=busyloop+in+sigchld_handler */ | ||
| 6521 | usleep (1000); | ||
| 6522 | errno = 0; | 6523 | errno = 0; |
| 6523 | pid = wait3 (&w, WNOHANG | WUNTRACED, 0); | 6524 | pid = wait3 (&w, WNOHANG | WUNTRACED, 0); |
| 6524 | } | 6525 | } |