src/Queue/Pipe.php
public function read($size = 1024)
    {
        if (!is_resource($this->read)) {
            $this->read = fopen($this->filename, 'r+');
            if (!is_resource($this->read)) {
                throw new \RuntimeException('open file failed');
            }
            if (!$this->block) {
                $set = stream_set_blocking($this->read, false);
                if (!$set) {
                    throw new \RuntimeException('stream_set_blocking failed');
                }
            }
        }

        return fread($this->read, $size);
    }
public function read($size = 1024)
    {
        if (!is_resource($this->read)) {
            $this->read = fopen($this->filename, 'r+');
            if (!is_resource($this->read)) {
                throw new \RuntimeException('open file failed');
            }
            if (!$this->block) {
                $set = stream_set_blocking($this->read, false);
                if (!$set) {
                    throw new \RuntimeException('stream_set_blocking failed');
                }
            }
        }

        return fread($this->read, $size);
    }
public function read ( $ size = 1024 ) { if ( ! is_resource ( $ this -> read ) ) { $ this -> read = fopen ( $ this -> filename , 'r+' ) ; if ( ! is_resource ( $ this -> read ) ) { throw new \ RuntimeException ( 'open file failed' ) ; } if ( ! $ this -> block ) { $ set = stream_set_blocking ( $ this -> read , false ) ; if ( ! $ set ) { throw new \ RuntimeException ( 'stream_set_blocking failed' ) ; } } } return fread ( $ this -> read , $ size ) ; }
if the stream is blocking, you would better set the value of size,
it will not return until the data size is equal to the value of param size

@param int $size
@return string
if the stream is blocking you would better set the value of size it will not return until the data size is equal to the value of param size