Commit 4c8975ad authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(wait_for_termination): Copy code from 18.59 (but sans BSD4_1 alternatives).

parent 02a76f8a
...@@ -314,16 +314,49 @@ wait_for_termination (pid) ...@@ -314,16 +314,49 @@ wait_for_termination (pid)
status = SYS$FORCEX (&pid, 0, 0); status = SYS$FORCEX (&pid, 0, 0);
break; break;
#else /* not VMS */ #else /* not VMS */
#if defined (BSD) || (defined (HPUX) && !defined (HPUX_5))
/* Exit if the process has terminated. */ /* Note that kill returns -1 even if the process is just a zombie now.
if (!synch_process_alive) But inevitably a SIGCHLD interrupt should be generated
and child_sig will do wait3 and make the process go away. */
/* There is some indication that there is a bug involved with
termination of subprocesses, perhaps involving a kernel bug too,
but no idea what it is. Just as a hunch we signal SIGCHLD to see
if that causes the problem to go away or get worse. */
sigsetmask (sigmask (SIGCHLD));
if (0 > kill (pid, 0))
{
sigsetmask (SIGEMPTYMASK);
kill (getpid (), SIGCHLD);
break;
}
if (wait_debugging)
sleep (1);
else
sigpause (SIGEMPTYMASK);
#else /* not BSD, and not HPUX version >= 6 */
#ifdef UNIPLUS
if (0 > kill (pid, 0))
break; break;
/* Otherwise wait 1 second or until a signal comes in. */ wait (0);
signal (SIGALRM, wait_for_termination_signal); #else /* neither BSD nor UNIPLUS: random sysV */
alarm (1); #ifdef HAVE_SYSV_SIGPAUSE
pause (); sighold (SIGCHLD);
alarm (0); if (0 > kill (pid, 0))
signal (SIGALRM, SIG_IGN); {
sigrelse (SIGCHLD);
break;
}
sigpause (SIGCHLD);
#else /* not HAVE_SYSV_SIGPAUSE */
if (0 > kill (pid, 0))
break;
/* Using sleep instead of pause avoids timing error.
If the inferior dies just before the sleep,
we lose just one second. */
sleep (1);
#endif /* not HAVE_SYSV_SIGPAUSE */
#endif /* not UNIPLUS */
#endif /* not BSD, and not HPUX version >= 6 */
#endif /* not VMS */ #endif /* not VMS */
#else /* not subprocesses */ #else /* not subprocesses */
#ifndef BSD4_1 #ifndef BSD4_1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment