Re: Re: process creation

From: Date: Sun, 25 Jan 2009 12:02:01 +0000
Subject: Re: Re: process creation
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-287091@lists.php.net to get a copy of this message
Per Jessen wrote: > 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 > for($icount=0;$icount<11;$icount++) Iterates 10 times?? Hmm

« previous php.general (#287091) next »