--- !ruby/object:RDoc::RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:RDoc::Markup::Flow::P 
  :body: Reads at most <em>maxlen</em> bytes from <em>ios</em> using the read(2) system call after O_NONBLOCK is set for the underlying file descriptor.
- !ruby/struct:RDoc::Markup::Flow::P 
  :body: If the optional <em>outbuf</em> argument is present, it must reference a String, which will receive the data.
- !ruby/struct:RDoc::Markup::Flow::P 
  :body: "read_nonblock just calls the read(2) system call. It causes all errors the read(2) system call causes: Errno::EWOULDBLOCK, Errno::EINTR, etc. The caller should care such errors."
- !ruby/struct:RDoc::Markup::Flow::P 
  :body: read_nonblock causes EOFError on EOF.
- !ruby/struct:RDoc::Markup::Flow::P 
  :body: If the read buffer is not empty, read_nonblock reads from the buffer like readpartial. In this case, the read(2) system call is not called.
- !ruby/struct:RDoc::Markup::Flow::P 
  :body: When read_nonblock raises EWOULDBLOCK, read_nonblock should not be called until io is readable for avoiding busy loop. This can be done as follows.
- !ruby/struct:RDoc::Markup::Flow::VERB 
  :body: "  begin\n    result = io.read_nonblock(maxlen)\n  rescue Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EINTR\n    IO.select([io])\n    retry\n  end\n"
- !ruby/struct:RDoc::Markup::Flow::P 
  :body: Note that this is identical to readpartial except the non-blocking flag is set.
full_name: IO#read_nonblock
is_singleton: false
name: read_nonblock
params: |
  ios.read_nonblock(maxlen)              => string
  ios.read_nonblock(maxlen, outbuf)      => outbuf

visibility: public
