Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Managing the fork/execing and reaping of child processes

by mr_mischief (Monsignor)
on Jul 16, 2015 at 19:19 UTC ( [id://1135068]=note: print w/replies, xml ) Need Help??


in reply to Re: Managing the fork/execing and reaping of child processes
in thread Managing the fork/execing and reaping of child processes

If the fork fails, you're still incrementing both $active_readers and $total. Those should probably be tracked in the parent.

Replies are listed 'Best First'.
Re^3: Managing the fork/execing and reaping of child processes
by Anonymous Monk on Jul 16, 2015 at 19:27 UTC

    If the fork fails, the parent dies. Is that tracking enough? I figure that if the fork fails it's going to muck things up enough that the die is proper.

      Okay, let me put it this way. If one wanted to not just die and to attempt to actually deal with not being able to fork more than X children even though Y children were requested, the example would need more changes than just removing the die() and reporting the error. The counts would also need to be moved. So in an example program that's going to be expanded upon and altered, it may be fruitful to track those things in the proper place from the beginning.

        If you're going to remove the die, just replace it with decrementing the counters. :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-03-29 07:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found