Commit 78a249f5 authored by unknown's avatar unknown

Use mtr_kill_process from mtr_kill_processes

Change to use 0.1 second sleep between kill attempt

parent 4f0bda6a
...@@ -927,14 +927,14 @@ sub sleep_until_file_created ($$$) { ...@@ -927,14 +927,14 @@ sub sleep_until_file_created ($$$) {
sub mtr_kill_processes ($) { sub mtr_kill_processes ($) {
my $pids = shift; my $pids = shift;
mtr_verbose("mtr_kill_processes " . join(" ", @$pids)); mtr_verbose("mtr_kill_processes " . join(" ", @$pids));
foreach my $sig (15, 9)
foreach my $pid (@$pids)
{ {
my $retries= 10; foreach my $sig (15, 9)
while (1)
{ {
kill($sig, @{$pids}); last if mtr_kill_process($pid, $sig, 10, 1);
last unless kill (0, @{$pids}) and $retries--;
} }
} }
} }
...@@ -945,17 +945,20 @@ sub mtr_kill_process ($$$$) { ...@@ -945,17 +945,20 @@ sub mtr_kill_process ($$$$) {
my $signal= shift; my $signal= shift;
my $retries= shift; my $retries= shift;
my $timeout= shift; my $timeout= shift;
my $max_loop= $timeout*10; # Sleeping 0.1 between each kill attempt
while (1) while (1)
{ {
kill($signal, $pid); kill($signal, $pid);
last unless kill (0, $pid) and $retries--; last unless kill (0, $pid) and $max_loop--;
mtr_debug("Sleep $timeout second waiting for processes to die"); mtr_verbose("Sleep 0.1 second waiting for processes to die");
sleep($timeout); select(undef, undef, undef, 0.1);
} }
return $max_loop;
} }
############################################################################## ##############################################################################
......
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