Skip to content

Commit 1d1db97

Browse files
committed
test.pl: Always set up (simpler) watchdog END block
This commit removes the existing END blocks that vary depending on the type of timer being used, and replaces them with a single END block that always exists, and simply calls watchdog(0). This already cancels whatever watchdogs are in place, doing nothing if none are. Spotted by Tony Cook Even though a test file should clear every timer before exit, this makes sure it happens.
1 parent 3533239 commit 1d1db97

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

t/test.pl

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,6 +1840,9 @@ sub warning_like {
18401840
my $watchdog_thread;
18411841
my $watchdog_alarm;
18421842

1843+
# Add END block to terminate and clean up any watchdog
1844+
END { watchdog(0); };
1845+
18431846
sub watchdog ($;$)
18441847
{
18451848
my $timeout = shift;
@@ -1953,23 +1956,13 @@ ($;$)
19531956
goto WATCHDOG_VIA_ALARM;
19541957
}
19551958

1956-
# Add END block to parent to terminate and clean up watchdog
1957-
# process
1958-
eval("END { local \$! = 0; local \$? = 0;
1959-
wait() if kill('KILL', $watchdog_process); };");
19601959
return;
19611960
}
19621961

19631962
# Try using fork() to generate a watchdog process
19641963
eval { $watchdog_process = fork() };
19651964
if (defined($watchdog_process)) {
1966-
if ($watchdog_process) { # Parent process
1967-
# Add END block to parent to terminate and clean up watchdog
1968-
# process
1969-
eval "END { local \$! = 0; local \$? = 0;
1970-
wait() if kill('KILL', $watchdog_process); };";
1971-
return;
1972-
}
1965+
return if $watchdog_process; # Parent process
19731966

19741967
### Watchdog process code
19751968

0 commit comments

Comments
 (0)