lib/Loop/Loop.php
protected function runStreams($timeout)
    {
        if ($this->readStreams || $this->writeStreams) {
            $read = $this->readStreams;
            $write = $this->writeStreams;
            $except = null;
            if (stream_select($read, $write, $except, (null === $timeout) ? null : 0, $timeout ? (int) ($timeout * 1000000) : 0)) {
                // See PHP Bug https://bugs.php.net/bug.php?id=62452
                // Fixed in PHP7
                foreach ($read as $readStream) {
                    $readCb = $this->readCallbacks[(int) $readStream];
                    $readCb();
                }
                foreach ($write as $writeStream) {
                    $writeCb = $this->writeCallbacks[(int) $writeStream];
                    $writeCb();
                }
            }
        } elseif ($this->running && ($this->nextTick || $this->timers)) {
            usleep(null !== $timeout ? intval($timeout * 1000000) : 200000);
        }
    }
protected function runStreams($timeout)
    {
        if ($this->readStreams || $this->writeStreams) {
            $read = $this->readStreams;
            $write = $this->writeStreams;
            $except = null;
            if (stream_select($read, $write, $except, (null === $timeout) ? null : 0, $timeout ? (int) ($timeout * 1000000) : 0)) {
                // See PHP Bug https://bugs.php.net/bug.php?id=62452
                // Fixed in PHP7
                foreach ($read as $readStream) {
                    $readCb = $this->readCallbacks[(int) $readStream];
                    $readCb();
                }
                foreach ($write as $writeStream) {
                    $writeCb = $this->writeCallbacks[(int) $writeStream];
                    $writeCb();
                }
            }
        } elseif ($this->running && ($this->nextTick || $this->timers)) {
            usleep(null !== $timeout ? intval($timeout * 1000000) : 200000);
        }
    }
protected function runStreams ( $ timeout ) { if ( $ this -> readStreams || $ this -> writeStreams ) { $ read = $ this -> readStreams ; $ write = $ this -> writeStreams ; $ except = null ; if ( stream_select ( $ read , $ write , $ except , ( null === $ timeout ) ? null : 0 , $ timeout ? ( int ) ( $ timeout * 1000000 ) : 0 ) ) { // See PHP Bug https://bugs.php.net/bug.php?id=62452 // Fixed in PHP7 foreach ( $ read as $ readStream ) { $ readCb = $ this -> readCallbacks [ ( int ) $ readStream ] ; $ readCb ( ) ; } foreach ( $ write as $ writeStream ) { $ writeCb = $ this -> writeCallbacks [ ( int ) $ writeStream ] ; $ writeCb ( ) ; } } } elseif ( $ this -> running && ( $ this -> nextTick || $ this -> timers ) ) { usleep ( null !== $ timeout ? intval ( $ timeout * 1000000 ) : 200000 ) ; } }
Runs all pending stream events.

If $timeout is 0, it will return immediately. If $timeout is null, it
will wait indefinitely.

@param float|null timeout
Runs all pending stream events .