in reply to Re: Re: Re: Perl IPC: Checking Exit Status of Child Process
in thread Perl IPC: Checking Exit Status of Child Process


Hi
Thank you very much for replying back. I had a question
regarding multiple forks in a loop:
1. How do I ensure that all child processes are running conurrently
2. Also, How can I execute different subroutines for each child
Looking forward to hear from you.
Thanks
  • Comment on Re: Re: Re: Re: Perl IPC: Checking Exit Status of Child Process

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Perl IPC: Checking Exit Status of Child Process
by mr_mischief (Monsignor) on May 19, 2003 at 20:45 UTC
    1) That requires IPC of some sort.

    2) TMTOWTDI.

    2a) You could increment a status variable meant specifically for this purpose before the fork() in the parent, and each child would then get their private version of that variable after the fork() at the value that was current during the fork(). You could then run a different sub or exec() a different file based on the value of that variable.

    2b) This is more complex than the above. You could have each child communicate back to the parent to ask.

    2c) You could keep a file/database entry for each task that has been started (like a pid file) and start whichever one is next.

    My vote for #2 is 2a.

    Christopher E. Stith
    use coffee;