Re: Re: process creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Török Alpár wrote:

> as i said it's hate here, and i might be wrong but consider the
> following  :
> 
> for($icount=0;$icount<11;$icount++)
> {
>   $iPid  =  pcntl_fork();
>   $iChildrenCount = 0;
>   if ($iPid == 0)
>   {
>     // child
>     echo ("child $icount\n");
>   }
>   else
>   {
>     // parrent
>   }
> }
> 
> this is essential what you do in your example? If so, this code does
> not start 10 children. It starts more.

Thats right - with the code above, each new child will continue creating
more processes. To get exactly 10 children running the same code:

if ($iPid == 0)
{
   // child
   echo ("child $icount\n");
   
   // do childish stuff
   // then exit
   exit;
}


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux