- 论坛徽章:
- 1
|
perl fork
In parent process,
you need to capture
$SIG{CHLD} =\&some_handle;
because , the signal "CHLD" for the parent,
will cause the parent to exit...
and I guess your question is that
when the first child process end, it throws a CHLD
signal to the parent, and the parent process
dies by default,
and at this time , the root process (1) will take over
the position of the parent process...
then the second child process end, it throws a CHLD
signal to the root process...and itself becomes a zombie.....
So If you don't wanna this situation happens ,
just add the line I write above to handle the CHLD Signal....
and maybe you will get the right answer...
Sorry, I am not at my office, and I can't type in chinese at
this machine.....

Try it.... |
|