in reply to Re: Setting signal handlers considered unsafe?
in thread Setting signal handlers considered unsafe?
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Setting signal handlers considered unsafe?
by TGI (Parson) on Nov 05, 2008 at 23:32 UTC | |
|
Re^3: Setting signal handlers considered unsafe?
by ig (Vicar) on Nov 11, 2008 at 17:41 UTC | |
by gnosek (Sexton) on Nov 12, 2008 at 13:24 UTC |