On Tue, Oct 4, 2016 at 2:07 PM, X Dungeness <dery...@gmail.com> 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: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to