NYCPHP Meetup

NYPHP.org

[nycphp-talk] pcntl_* functions.

Freedman, Tom S. Thomas.Freedman at ubs.com
Fri Oct 10 14:17:20 EDT 2003


> -----Original Message-----
> From: max goldberg [mailto:max at idsociety.com]
[snip!]
> if ($is_daemon == true) {
>   $waitpid_status = null;
>   echo "[ MASTER ] Waiting For Children to Die!\n";
>   pcntl_waitpid (-1, &$waitpid_status, WUNTRACED);
>   echo "[ MASTER ] My Children are dead!\n";
[snip!]
> Obviously the master is only waiting for the first child to die out 
> before it responds
> that they are all done.I have a few options, one of which is keep an 
> array of the pid's
> of each fork and then loop and wait for each of them.I was just 
> wondering if it was
> possible to have it wait for any and all forked processes with one 
> command. Does
> anyone have any experience with this?

There really isn't any other way to do it than to keep track of all your
child PIDs and test for them all to return.  pcntl_waitpid(-1, $foo), as you
say, returns once any child exits.

> 
> Thanks, and sorry for the long mail!
> -Max

Hey, long mails mean less time spend asking for more info! :-)

-Tom


Please do not transmit orders or instructions regarding a UBS account by
email. The information provided in this email or any attachments is not an
official transaction confirmation or account statement. For your protection,
do not include account numbers, Social Security numbers, credit card
numbers, passwords or other non-public information in your email. Because
the information contained in this message may be privileged, confidential,
proprietary or otherwise protected from disclosure, please notify us
immediately by replying to this message and deleting it from your computer
if you have received this communication in error.  Thank you.

UBS Financial Services Inc.
UBS International Inc.




More information about the talk mailing list