Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: fork-bomb!

by Juerd (Abbot)
on Apr 29, 2003 at 22:10 UTC ( #254124=note: print w/replies, xml ) Need Help??

in reply to fork-bomb!

If fork returns false, don't just assume you're the child. The returned value can be undef, which means fork failed. If you fail to check for undef, your code has very strange bugs when forking fails (which happens under heavy load, when you exceed resources, etc).

if (my $pid = fork) { # parent } elsif (defined $pid) { # child exit; } else { die $!; }
or one of the 1e6 other ways to write that.

Juerd # { site => '', plp_site => '', do_not_use => 'spamtrap' }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2016-10-23 07:16 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (300 votes). Check out past polls.