summaryrefslogtreecommitdiff
path: root/src/process.c
diff options
context:
space:
mode:
authorSam Steingold <sds@gnu.org>2007-03-25 03:03:40 +0000
committerSam Steingold <sds@gnu.org>2007-03-25 03:03:40 +0000
commite7d4a9040500018652ec1e626e4eb349c406764e (patch)
treebb70f9cfc1a799453a0f0a41b7322b9d49bfd1f9 /src/process.c
parenta0ca081df23387a3f7dc57a61cded8e7c9c1cbe1 (diff)
downloademacs-e7d4a9040500018652ec1e626e4eb349c406764e.tar.gz
revert the last patch to the original fix: sleep BEFORE the first wait
it appears to be absolutely necessary for prevention of the load surge
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/process.c b/src/process.c
index 10bfa762a9b..382db8b2578 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6501,17 +6501,17 @@ sigchld_handler (signo)
#define WUNTRACED 0
#endif /* no WUNTRACED */
/* Keep trying to get a status until we get a definitive result. */
- while (1)
- {
+ do
+ {
+ /* For some reason, this sleep() prevents Emacs from sending
+ loadavg to 5-8(!) for ~10 seconds.
+ See http://thread.gmane.org/gmane.emacs.devel/67722 or
+ http://www.google.com/search?q=busyloop+in+sigchld_handler */
+ sleep (1);
errno = 0;
pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
- if (! (pid < 0 && errno == EINTR))
- break;
- /* Avoid a busyloop: wait3 is a system call, so we do not want
- to prevent the kernel from actually sending SIGCHLD to emacs
- by asking for it all the time. */
- sleep (1);
}
+ while (pid < 0 && errno == EINTR);
if (pid <= 0)
{