From 9af1e791fe19b19fee975c6b151f15feedd0edd3 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 17 Sep 2009 23:50:10 +0200 Subject: [PATCH] Use `waitpid' to check if a process is still alive. The previous mechanism caused threads to hang. --- src/sysdep.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 2.39.5