in reply to fork exits prematurely leaving zombies
My forking is a bit rusty, so hopefully, I'm getting this right. Since process A is the parent of process B, there should be a wait there. Otherwise if process A finishes, it will wait on process C only. So, if process C finishes before process B, you'll get a zombie. The following may work a bit better.
if ($pid = fork()) { if ($pid2 = fork()) { <process A>; waitpid $pid2, 0; } else { <process B>; exit; } waitpid $pid, 0; } else { <process C> exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: fork exits prematurely leaving zombies
by thor (Priest) on May 11, 2004 at 23:30 UTC |