Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Setting signal handlers considered unsafe?

by gone2015 (Deacon)
on Nov 05, 2008 at 18:36 UTC ( [id://721760]=note: print w/replies, xml ) Need Help??


in reply to Setting signal handlers considered unsafe?

sub f { local $SIG{ALRM} = sub { print "SIGALRM\n" }; # line 9 } if (fork) { # parent f while 1; } else {

The f while 1 will call f repeatedly and for ever. I don't know why you'd want to keep setting $SIG{ALRM} over and over again. I also guess that the local will use a small amount of memory each time....

Update: I apologize: I had missed the point that the mystery was that setting $SIG{ALRM} in the way shown seemed to expose the default setting, despite there being a previous setting replacing the default. While I'm at it, I can find no evidence to support the suggestion that the local might be eating memory, so I retract that entirely <blush>. (I think I'll go and have a little lie down, now.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://721760]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-26 02:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found