# HG changeset patch # User Sam Steingold # Date 1173647325 0 # Node ID deede4f7067d04640c6eb770e1579784546e6825 # Parent 1192779764c1b4d2e9fd63eb3a0623125a18e69b tweak last patch: add comment and avoid the first sleep diff -r 1192779764c1 -r deede4f7067d src/process.c --- a/src/process.c Sun Mar 11 20:13:23 2007 +0000 +++ b/src/process.c Sun Mar 11 21:08:45 2007 +0000 @@ -6495,13 +6495,16 @@ #define WUNTRACED 0 #endif /* no WUNTRACED */ /* Keep trying to get a status until we get a definitive result. */ - do - { - sleep (1); - errno = 0; - pid = wait3 (&w, WNOHANG | WUNTRACED, 0); - } - while (pid < 0 && errno == EINTR); + while (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); + } if (pid <= 0) {