inline status wait_children(Children &cs) { BOOST_ASSERT(cs.size() >= 2); typename Children::iterator it = cs.begin(); while (it != cs.end()) { const status s = it->wait(); ++it; if (it == cs.end()) return s; else if (!s.exited() || s.exit_status() != EXIT_SUCCESS) { while (it != cs.end()) { it->wait(); ++it; } return s; } } BOOST_ASSERT(false); return cs.begin()->wait(); }
/// Terminates the current process reproducing the given status. /// /// The caller process is abruptly terminated. In particular, no output streams /// are flushed, no destructors are called, and no atexit(2) handlers are run. /// /// \param status The status to "re-deliver" to the caller process. void process::terminate_self_with(const status& status) { if (status.exited()) { ::_exit(status.exitstatus()); } else { INV(status.signaled()); (void)::kill(::getpid(), status.termsig()); UNREACHABLE_MSG(F("Signal %s terminated %s but did not terminate " "ourselves") % status.termsig() % status.dead_pid()); } }