bool WaitUntilTerminates = false;
if (!SecondsToWait) {
WaitUntilTerminates = true;
- } else if (*SecondsToWait != 0) {
+ } else {
+ if (*SecondsToWait == 0)
+ WaitPidOptions = WNOHANG;
+
// Install a timeout handler. The handler itself does nothing, but the
// simple fact of having a handler at all causes the wait below to return
// with EINTR, unlike if we used SIG_IGN.
// FIXME The alarm signal may be delivered to another thread.
alarm(*SecondsToWait);
- } else {
- WaitPidOptions = WNOHANG;
}
// Parent process: Wait for the child process to terminate.