fix killing code I just broke, and give program a chance to cleanup.
This commit is contained in:
parent
8ddb33d2b3
commit
b460fa25a2
9
external/bsd/atf/dist/atf-run/timer.cpp
vendored
9
external/bsd/atf/dist/atf-run/timer.cpp
vendored
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user