Jenner\SimpleFork\FixedPool::wait PHP Метод

wait() публичный Метод

wait for all process done
public wait ( boolean $block = false, integer $interval = 100 )
$block boolean block the master process to keep the sub process count all the time
$interval integer check time interval
    public function wait($block = false, $interval = 100)
    {
        do {
            if ($this->isFinished()) {
                return;
            }
            parent::wait(false);
            if ($this->aliveCount() < $this->max) {
                foreach ($this->processes as $process) {
                    if ($process->isStarted()) {
                        continue;
                    }
                    $process->start();
                    if ($this->aliveCount() >= $this->max) {
                        break;
                    }
                }
            }
            $block ? usleep($interval) : null;
        } while ($block);
    }