Mercurial > emacs
comparison src/process.c @ 76462:deede4f7067d
tweak last patch: add comment and avoid the first sleep
author | Sam Steingold <sds@gnu.org> |
---|---|
date | Sun, 11 Mar 2007 21:08:45 +0000 |
parents | 720d443bce01 |
children | e5e12c57c640 8c2ef9d5d4a8 |
comparison
equal
deleted
inserted
replaced
76461:1192779764c1 | 76462:deede4f7067d |
---|---|
6493 #ifdef WNOHANG | 6493 #ifdef WNOHANG |
6494 #ifndef WUNTRACED | 6494 #ifndef WUNTRACED |
6495 #define WUNTRACED 0 | 6495 #define WUNTRACED 0 |
6496 #endif /* no WUNTRACED */ | 6496 #endif /* no WUNTRACED */ |
6497 /* Keep trying to get a status until we get a definitive result. */ | 6497 /* Keep trying to get a status until we get a definitive result. */ |
6498 do | 6498 while (1) { |
6499 { | 6499 errno = 0; |
6500 sleep (1); | 6500 pid = wait3 (&w, WNOHANG | WUNTRACED, 0); |
6501 errno = 0; | 6501 if (! (pid < 0 && errno == EINTR)) |
6502 pid = wait3 (&w, WNOHANG | WUNTRACED, 0); | 6502 break; |
6503 } | 6503 /* avoid a busyloop: wait3 is a system call, so we do not want |
6504 while (pid < 0 && errno == EINTR); | 6504 to prevent the kernel from actually sending SIGCHLD to emacs |
6505 by asking for it all the time */ | |
6506 sleep (1); | |
6507 } | |
6505 | 6508 |
6506 if (pid <= 0) | 6509 if (pid <= 0) |
6507 { | 6510 { |
6508 /* PID == 0 means no processes found, PID == -1 means a real | 6511 /* PID == 0 means no processes found, PID == -1 means a real |
6509 failure. We have done all our job, so return. */ | 6512 failure. We have done all our job, so return. */ |