@@ -1890,8 +1890,7 @@ ($;$)
18901890 # shut up use only once warning
18911891 my $threads_on = $threads::threads && $threads::threads ;
18921892
1893- # Don't use a watchdog process if 'threads' is loaded -
1894- # use a watchdog thread instead
1893+ # Use a watchdog process unless 'threads' is loaded
18951894 if (!$threads_on || $method eq " process" ) {
18961895
18971896 # On Windows and VMS, try launching a watchdog process
@@ -1952,8 +1951,8 @@ ($;$)
19521951 return ;
19531952 }
19541953
1955- # Add END block to parent to terminate and
1956- # clean up watchdog process
1954+ # Add END block to parent to terminate and clean up watchdog
1955+ # process
19571956 eval (" END { local \$ ! = 0; local \$ ? = 0;
19581957 wait() if kill('KILL', $watchdog ); };" );
19591958 return ;
@@ -1964,8 +1963,8 @@ ($;$)
19641963 eval { $watchdog = fork () };
19651964 if (defined ($watchdog )) {
19661965 if ($watchdog ) { # Parent process
1967- # Add END block to parent to terminate and
1968- # clean up watchdog process
1966+ # Add END block to parent to terminate and clean up watchdog
1967+ # process
19691968 eval " END { local \$ ! = 0; local \$ ? = 0;
19701969 wait() if kill('KILL', $watchdog ); };" ;
19711970 return ;
@@ -2002,8 +2001,8 @@ ($;$)
20022001 # fork() failed - fall through and try using a thread
20032002 }
20042003
2005- # Use a watchdog thread because either 'threads' is loaded,
2006- # or fork() failed
2004+ # Use a watchdog thread because either 'threads' is loaded, or fork()
2005+ # failed
20072006 if (eval {require threads; 1}) {
20082007 $watchdog_thread = ' threads' -> create(sub {
20092008 # Load POSIX if available
@@ -2042,7 +2041,8 @@ ($;$)
20422041 return ;
20432042 }
20442043
2045- # If everything above fails, then just use an alarm timeout
2044+ # If everything above fails, then just use an alarm timeout. There can
2045+ # only be one in effect at a time. This cancels any previous one.
20462046WATCHDOG_VIA_ALARM:
20472047 if (eval { alarm($timeout ); 1; }) {
20482048 # Load POSIX if available
0 commit comments