in reply to Handling multiple clients
I've found that the Cookbook code for dealing with SIGCHLD seems to be a bit unreliable (See $? is -1???). As best I could ever figure, despite documentation to the contrary, it appeared that the signal handling didn't actually handle reentrancy correctly.
However, I think you could get rid of the signal handler and just do something like replace
with# And maintain the population. while (1) { sleep; # wait for a signal (i.e., child's + death) for ($i = $children; $i < $PREFORK; $i++) { make_new_child(); # top up the child pool } }
# And maintain the population. while ((my $pid = waitpid(-1)) > 0) { $children--; delete $children{$pid}; make_new_child() }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Handling multiple clients
by ranjan_jajodia (Monk) on Sep 05, 2004 at 06:16 UTC | |
by kscaldef (Pilgrim) on Sep 05, 2004 at 21:27 UTC |