DCPM: fork oddness

Steve Marvell steve at fysh.org
Wed Nov 27 04:54:41 CST 2002


On Tue, Nov 26, 2002 at 07:17:56PM +0000, Alex Charrett wrote:

> Ok, that seems to be working until I hit the point where I may have more
> than one child at a time, how do I tell which is sending me the SIGCHLD?

You don't need to, you jnust need to wait for ll the dead children to
go. 

if you ...

while ($pid = waitpid(-1,&WNOHANG) > 0) {

      # do something with $pid, or not
}

Then you'll wait for everyone to die.

Alternatively if you IGNORE the SIGCHLD, then I believe the system
will just sort it out for you.

$SIG{'CHLD'} = 'IGNORE';

This is a good option when you want to do nothing with the children.

Steve



More information about the Devoncornwall-pm mailing list