On Tue, Oct 4, 2016 at 2:07 PM, X Dungeness <[email protected]> wrote:
> Here's a possibly relevant note in the docs for both "alarm" and
> "sleep":
>
> It is usually a mistake to intermix "alarm" and "sleep" calls,
> because "sleep" may be internally implemented on your system
> with "alarm".
>
>
>
It may be irrelevant on recent OS's too. An 'exec' inside a signal
handler looks like the problematic issue. The following runs fine:
use feature 'say';
say "starting at ",scalar localtime();
my $alarm = 0;
$SIG{ALRM} = sub{++$alarm;};
while (1) {
if ($alarm) {
$alarm = 0;
exec $^X,$0;
die "can't exec";
}
alarm(3);
sleep 6;
}
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/