public function wait($timeout = null, $step = 1000)
    {
        $withTimeout = false === is_null($timeout);

        if ($withTimeout) {
            $start = microtime(true);
            if ($timeout < $step) {
                $step = $timeout;
            }
        }

        while ($this->isRunning()) {
            usleep($step * 1000);

            if ($withTimeout && ($start + $timeout) > microtime(true)) {
                return;
            }
        }
    }
public function wait($timeout = null, $step = 1000)
    {
        $withTimeout = false === is_null($timeout);

        if ($withTimeout) {
            $start = microtime(true);
            if ($timeout < $step) {
                $step = $timeout;
            }
        }

        while ($this->isRunning()) {
            usleep($step * 1000);

            if ($withTimeout && ($start + $timeout) > microtime(true)) {
                return;
            }
        }
    }
public function wait ( $ timeout = null , $ step = 1000 ) { $ withTimeout = false === is_null ( $ timeout ) ; if ( $ withTimeout ) { $ start = microtime ( true ) ; if ( $ timeout < $ step ) { $ step = $ timeout ; } } while ( $ this -> isRunning ( ) ) { usleep ( $ step * 1000 ) ; if ( $ withTimeout && ( $ start + $ timeout ) > microtime ( true ) ) { return ; } } }
Wait until process end or wait time

@param int|null $timeout in ms
@param int $step in ms
Wait until process end or wait time