Gestionnaire de fichiers - Editer - /opt/cpanel/ea-ruby24/root/usr/share/ri/system/IO/read_nonblock-i.ri
Arrière
U:RDoc::AnyMethod[iI"read_nonblock:EFI"IO#read_nonblock;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"?Reads at most <i>maxlen</i> bytes from <em>ios</em> using ;TI"9the read(2) system call after O_NONBLOCK is set for ;TI"$the underlying file descriptor.;To:RDoc::Markup::BlankLine o; ; [ I"8If the optional <i>outbuf</i> argument is present, ;TI">it must reference a String, which will receive the data. ;TI"QThe <i>outbuf</i> will contain only the received data after the method call ;TI".even if it is not empty at the beginning.;T@o; ; [I"7read_nonblock just calls the read(2) system call. ;TI"aIt causes all errors the read(2) system call causes: Errno::EWOULDBLOCK, Errno::EINTR, etc. ;TI"(The caller should care such errors.;T@o; ; [ I">If the exception is Errno::EWOULDBLOCK or Errno::EAGAIN, ;TI")it is extended by IO::WaitReadable. ;TI"KSo IO::WaitReadable can be used to rescue the exceptions for retrying ;TI"read_nonblock.;T@o; ; [I"*read_nonblock causes EOFError on EOF.;T@o; ; [I"+If the read byte buffer is not empty, ;TI";read_nonblock reads from the buffer like readpartial. ;TI"9In this case, the read(2) system call is not called.;T@o; ; [ I"FWhen read_nonblock raises an exception kind of IO::WaitReadable, ;TI"(read_nonblock should not be called ;TI"2until io is readable for avoiding busy loop. ;TI"!This can be done as follows.;T@o:RDoc::Markup::Verbatim; [I"-# emulates blocking read (readpartial). ;TI"begin ;TI") result = io.read_nonblock(maxlen) ;TI"rescue IO::WaitReadable ;TI" IO.select([io]) ;TI" retry ;TI" end ;T:@format0o; ; [ I"?Although IO#read_nonblock doesn't raise IO::WaitWritable. ;TI"BOpenSSL::Buffering#read_nonblock can raise IO::WaitWritable. ;TI"3If IO and SSL should be used polymorphically, ;TI"-IO::WaitWritable should be rescued too. ;TI"JSee the document of OpenSSL::Buffering#read_nonblock for sample code.;T@o; ; [I"7Note that this method is identical to readpartial ;TI")except the non-blocking flag is set.;T@o; ; [ I"OBy specifying a keyword argument _exception_ to +false+, you can indicate ;TI"Lthat read_nonblock should not raise an IO::WaitReadable exception, but ;TI"Lreturn the symbol +:wait_readable+ instead. At EOF, it will return nil ;TI"!instead of raising EOFError.;T: @fileI"prelude.rb;T:0@omit_headings_from_table_of_contents_below0I"ios.read_nonblock(maxlen [, options]) -> string ios.read_nonblock(maxlen, outbuf [, options]) -> outbuf ;T0[ I"&(len, buf = nil, exception: true);T@JFI"IO;TcRDoc::NormalClass00
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Génération de la page: 0.09 |
proxy
|
phpinfo
|
Réglages