in reply to Forks/Threads
Basically, you call it once, it returns twice. If it's the child, it returns 0. If the parent, returns the child's PID. So, from Camel:
Left out some error checking stuff. make sure you wait for your child processes, or your parent will terminate and leave the kids hangin. Read up on fork, wait, and check out $SIG{CHLD} for handling forks. It's a confusing subject at first, but you'll soon pick it up.if ($pid = fork) { # parent here. } elsif (defined $pid) { #child here. }
Enjoy!
Trinary
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Forks/Threads
by Anonymous Monk on Feb 05, 2001 at 08:51 UTC |