Skip to content

Commit aaa60ee

Browse files
committed
test.pl: Simpler method to cancel watchdog timers
The added END block can simply call watchdog(0), which already has the knowledge to be able to cancel whichever watachdog method is used. Spotted by Tony Cook A comment is added as to why no cancellation is needed of a watchdog implemented by alarm(). Even though a test file should clear every timer before exit, this makes sure it happens.
1 parent 7e134e7 commit aaa60ee

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

t/test.pl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,8 +1952,7 @@ ($;$)
19521952

19531953
# Add END block to parent to terminate and clean up watchdog
19541954
# process
1955-
eval("END { local \$! = 0; local \$? = 0;
1956-
wait() if kill('KILL', $watchdog); };");
1955+
eval("END { watchdog(0); };");
19571956
return;
19581957
}
19591958

@@ -1969,8 +1968,7 @@ ($;$)
19691968
if ($watchdog) { # Parent process
19701969
# Add END block to parent to terminate and clean up watchdog
19711970
# process
1972-
eval "END { local \$! = 0; local \$? = 0;
1973-
wait() if kill('KILL', $watchdog); };";
1971+
eval("END { watchdog(0); };");
19741972
return;
19751973
}
19761974

@@ -2060,6 +2058,9 @@ ($;$)
20602058
my $sig = $is_vms ? 'TERM' : 'KILL';
20612059
kill($sig, $pid_to_kill);
20622060
};
2061+
2062+
# No need to clear a watchdog implemented by alarm(); it goes away
2063+
# automatically when the process dies
20632064
}
20642065
}
20652066
} # End closure

0 commit comments

Comments
 (0)