Just tried on my home Ubuntu system (perl 5.8.8). Ran for a few seconds (a new record!) and crashed with
This is the exact code I used:Unable to create sub named "" at crash.pl line 15.
#!/usr/bin/perl use warnings FATAL => qw( all ); use strict; use POSIX qw( :signal_h ); $SIG{ALRM} = sub { print "SIGARLM: main handler\n" }; sub f { my $sigset = POSIX::SigSet->new; my $blockset = POSIX::SigSet->new( SIGALRM ); sigprocmask(SIG_BLOCK, $blockset, $sigset ); local $SIG{ALRM} = sub { print "SIGALRM\n" }; # line 15 sigprocmask(SIG_SETMASK, $sigset ); } if (fork) { # parent f while 1; } else { # child sleep 1; print "child starting\n"; 1 while kill ALRM => getppid; }
In reply to Re^2: Setting signal handlers considered unsafe?
by gnosek
in thread Setting signal handlers considered unsafe?
by gnosek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |