You might try the following on your system and let us know what happens...
#!/usr/bin/perl use warnings FATAL => qw( all ); use strict; $|=1; sub mainhandler { print "SIGALRM: main handler\n"; }; $SIG{ALRM} = \&mainhandler; sub f { $SIG{ALRM} = sub { print "SIGALRM: sub handler\n" }; # line 9 $SIG{ALRM} = \&mainhandler; } if (fork) { # parent f while 1; } else { # child sleep 7; print "child starting\n"; 1 while kill ALRM => getppid; }
Update: I have now run this script for well over an hour without any faults. There may still be race conditions as the signal handlers are changed, but the windows of vulnerability are much smaller than with the original script. I have not seen the Unable to create sub named "" error at any time.
In reply to Re: Setting signal handlers considered unsafe?
by ig
in thread Setting signal handlers considered unsafe?
by gnosek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |