in reply to RE: RE: Re: Getting Close and Cuddly with the sleep() function
in thread Getting Close and Cuddly with the sleep() function

I see,

wait, no, hold on. Where do you actually call the fork() function? Or how do you actually fork something into a child process? Thanks for the info on where to look for the correct documentation :) -justin simoni
!skazat!

  • Comment on RE: RE: RE: Re: Getting Close and Cuddly with the sleep() function

Replies are listed 'Best First'.
RE: RE: RE: RE: Re: Getting Close and Cuddly with the sleep() function
by cianoz (Friar) on Nov 06, 2000 at 16:09 UTC
    when you call the fork function ("if(fork())" does this) the current process get duplicated and the 2 processes keep running from the point where you called fork.
    now the only way you have to know if you are the parent or the child process is to test the exit status of fork() (here cames if(fork()) )
    fork return 0 to the child and the pid of the child to the parent (!=0 then true) so you put the code for the parent in the if block and the code for the child in the else block...

    please look at "perldoc -f fork" for more info.