On Wed, 2002-03-27 at 20:40, Ahmed Moustafa wrote:
> Chas Owens wrote:
> > I wrote some experimental code and it looks like you don't have to reap
> > the children (maybe this is just a C thing).
> 
> So, is it OK to fork processes without using waitpid?
> 
> In general, how are the servers (from the fork perspective - 
> multithreading handling -) implemented in Perl?
> 
<snip />

<snip href="perldoc -f fork">
If you "fork" without ever waiting on your children, 
you will accumulate zombies.  On some systems, you 
can avoid this by setting "$SIG{CHLD}" to ""IGNORE"".
See also the perlipc manpage for more examples of forking 
and reaping moribund children.
</snip>

Given the above statement I would first try and see 
if setting $SIG{CHLD} to 'IGNORE' keeps anything bad
from happening.  Barring that I would keep a list of 
all forked children and wait on them during idle time.

Another possible solution would be to use the POE
modules.  I have tried to use the once for a Gtk/Gnome
based application that I wanted to be multi-threaded, 
but ran into errors with the Gnome module (and subsequently
found a different way to get around the problem I wanted
multi-threading for).  I know there was someone on this 
list with much more experience with POE than I; maybe he
will speak up.

-- 
Today is Boomtime the 14th day of Discord in the YOLD 3168
You are what you see.

Missile Address: 33:48:3.521N  84:23:34.786W


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to