DCPM: fork oddness

Steve Marvell steve at fysh.org
Tue Nov 26 03:15:07 CST 2002


On Tue, Nov 26, 2002 at 01:03:30AM +0000, Alex Charrett wrote:

> I'm having an odd issue with fork maybe you guys can shed some light on.
> I've got a constantly running process that forks itself when doing time
> consuming tasks to make the front end script more responsive.  It's
> doing it's job nicely and I've got an exit(0) to get the child to
> terminate at the correct time. 
> 
> However, the exit is causing defunct processes to sit in the process
> list until the parent exits (which I don't want it to do as the parent
> isn't meant to exit).

The parent should wait() or waitpid() for the child after it
dies. You'll know when it dies from the SIGCHLD in the parent, which
you'll need to trap.

Steve



More information about the Devoncornwall-pm mailing list