Mercurial > emacs
diff src/process.c @ 76718:217f3f19f471
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
| author | Sam Steingold <sds@gnu.org> |
|---|---|
| date | Sun, 25 Mar 2007 03:03:40 +0000 |
| parents | 2fb8fb4a9bab |
| children | c39f6a4ef598 |
line wrap: on
line diff
--- a/src/process.c Sat Mar 24 23:26:46 2007 +0000 +++ b/src/process.c Sun Mar 25 03:03:40 2007 +0000 @@ -6501,17 +6501,17 @@ #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) {
