fix killing code I just broke, and give program a chance to cleanup.

This commit is contained in:
christos 2011-12-19 03:16:05 +00:00
parent 8ddb33d2b3
commit b460fa25a2

View File

@ -128,9 +128,10 @@ impl::child_timer::~child_timer(void)
void void
impl::child_timer::timeout_callback(void) impl::child_timer::timeout_callback(void)
{ {
static const timespec ts = { 1, 0 };
m_terminate = true; m_terminate = true;
::kill(-m_pid, SIGTERM);
// Should use killpg(2) but, according to signal(7), using this system ::nanosleep(&ts, NULL);
// call in a signal handler context is not safe. if (::kill(-m_pid, 0) != -1)
::killpg(-m_pid, SIGKILL); ::kill(-m_pid, SIGKILL);
} }