Dukelow, Don wrote:
>  
> I got this basic "fork" code right out of the book.

Which book?

>  It is suppose to wait
> for both child forks to finish before the parent falls through and excute
> the code after this "if" statement.  But which ever child finishes first the
> parrent will fall through and finish before all the children are done.  So
> I'm looseing data!  Outer wise it woork fine.  Can someone tell me why the
> parrent isn't waiting for both children?  The second child does finish a few
> minutes after all else is done.

That is the way that fork() works.  fork() creates a separate process that
runs independently from the parent process so unless you are using IPC to
synchronise them they will run whenever the OS allows them to run.  If you
want the parent to wait for the children then:

perldoc -f wait
perldoc -f waitpid
perldoc perlipc



John
-- 
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to