Quantcast
Channel: Kommentare zu: Parallel processing in PHP
Viewing all articles
Browse latest Browse all 38

Von: Indrek

$
0
0

You have done little wrong in fork example. Better example:

$pids = array();
for ($i = 0; $i < 4; $i++) { if ($pid = pcntl_fork()) { $pids[] = $pid; break; // Now I'm child process and exit from loop } } // Now must wait until all children are finished while ($pids) { $pid = pcntl_wait(0); // remove $pid from $pids }


Viewing all articles
Browse latest Browse all 38