From: Giuseppe Scrivano Date: Thu, 17 Sep 2009 21:50:10 +0000 (+0200) Subject: Use `waitpid' to check if a process is still alive. The previous mechanism caused... X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9af1e791fe19b19fee975c6b151f15feedd0edd3;p=emacs.git Use `waitpid' to check if a process is still alive. The previous mechanism caused threads to hang. --- diff --git a/src/sysdep.c b/src/sysdep.c index a9bdcc5afc7..48343701823 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -432,6 +432,10 @@ wait_for_termination (pid) sigpause (SIGEMPTYMASK); #else /* not BSD_SYSTEM, and not HPUX version >= 6 */ #ifdef POSIX_SIGNALS /* would this work for GNU/Linux as well? */ + int status; + int w; + /* XXX: can I replace this code without problems? --giuseppe + sigblock (sigmask (SIGCHLD)); errno = 0; if (kill (pid, 0) == -1 && errno == ESRCH) @@ -441,6 +445,10 @@ wait_for_termination (pid) } sigsuspend (&empty_mask); +*/ + w = waitpid (pid, &status, WUNTRACED | WCONTINUED); + if (w == -1 || WIFEXITED (w)) + break; #else /* not POSIX_SIGNALS */ #ifdef HAVE_SYSV_SIGPAUSE sighold (SIGCHLD);