protected function readAllChunkedGenHandler($cb, $chunkcb, $size, &$offset, $pri)
    {
        return function ($file, $data) use ($cb, $chunkcb, $size, &$offset, $pri) {
            $chunkcb($file, $data);
            $offset += mb_orig_strlen($data);
            $len = min($file->chunkSize, $size - $offset);

            if ($offset >= $size) {
                $cb($file, true);
                return;
            }

            eio_read(
                $file->fd,
                $len,
                $offset,
                $pri,
                $this->readAllChunkedGenHandler($cb, $chunkcb, $size, $offset, $pri),
                $file
            );
        };
    }