M
Michele Dondi
Hello All,
THis fork example is too good . can somebody explain me how this
works???....
"it_says_BALLS_on_your forehead" <[email protected]> wrote in message
*PLEASE* do not top post!
Well, just do something $num_kids times: the corresponding index, $i,
will be the "name" of the process.
Call fork().
If it is undef() then it didn't succeed at all. The die() immediately
with an error message. (But on a second thought, what if previous
fork()s succeeded?)
I am the child process.
So I say something, wait three seconds, say something else to make it
clear that it's me, and then I go away.
Since childs exit() early, this portion of code is only reached if I
am the parent. And I say so, mentioning my child.
Wait for all the childs to exit, to avoid leaving zombies laying
around.
Michele