private function startNext()
    {
        // this allows us to wait until all runs are added in the constructor before running any.
        // Thus preserving the priority they have supplied.
        if (!$this->initialised) {
            return;
        }

        if ($this->maxSimultaneous !== static::NO_MAX
            && $this->waitingQueue->valid()
            && count($this->running) < $this->maxSimultaneous) {
            for ($i = count($this->running); $i < $this->maxSimultaneous && $this->waitingQueue->valid(); $i++) {
                $this->startRun($this->waitingQueue->extract());
            }
        } elseif ($this->maxSimultaneous === static::NO_MAX) {
            while ($this->waitingQueue->valid()) {
                $this->startRun($this->waitingQueue->extract());
            }
        }
    }
private function startNext()
    {
        // this allows us to wait until all runs are added in the constructor before running any.
        // Thus preserving the priority they have supplied.
        if (!$this->initialised) {
            return;
        }

        if ($this->maxSimultaneous !== static::NO_MAX
            && $this->waitingQueue->valid()
            && count($this->running) < $this->maxSimultaneous) {
            for ($i = count($this->running); $i < $this->maxSimultaneous && $this->waitingQueue->valid(); $i++) {
                $this->startRun($this->waitingQueue->extract());
            }
        } elseif ($this->maxSimultaneous === static::NO_MAX) {
            while ($this->waitingQueue->valid()) {
                $this->startRun($this->waitingQueue->extract());
            }
        }
    }
private function startNext ( ) { // this allows us to wait until all runs are added in the constructor before running any. // Thus preserving the priority they have supplied. if ( ! $ this -> initialised ) { return ; } if ( $ this -> maxSimultaneous !== static :: NO_MAX && $ this -> waitingQueue -> valid ( ) && count ( $ this -> running ) < $ this -> maxSimultaneous ) { for ( $ i = count ( $ this -> running ) ; $ i < $ this -> maxSimultaneous && $ this -> waitingQueue -> valid ( ) ; $ i ++ ) { $ this -> startRun ( $ this -> waitingQueue -> extract ( ) ) ; } } elseif ( $ this -> maxSimultaneous === static :: NO_MAX ) { while ( $ this -> waitingQueue -> valid ( ) ) { $ this -> startRun ( $ this -> waitingQueue -> extract ( ) ) ; } } }
Check when a run has finished, if there are processes waiting, start them
Check when a run has finished if there are processes waiting start them