From: Aaron Patterson Date: 2011-11-20T14:05:20+09:00 Subject: [ruby-core:41165] Re: [Ruby 1.9 - Bug #5138][Open] Add nonblocking IO that does not use exceptions for EOF and EWOULDBLOCK --CdrF4e02JqNVZeln Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 02, 2011 at 07:35:15AM +0900, Yehuda Katz wrote: >=20 > Issue #5138 has been reported by Yehuda Katz. >=20 > ---------------------------------------- > Bug #5138: Add nonblocking IO that does not use exceptions for EOF and EW= OULDBLOCK > http://redmine.ruby-lang.org/issues/5138 >=20 > Author: Yehuda Katz > Status: Open > Priority: Normal > Assignee: Yukihiro Matsumoto > Category: core > Target version: 1.9.4 > ruby -v: ruby 1.9.4dev (2011-07-31 trunk 32788) [x86_64-darwin11.0.0] >=20 >=20 > The current Ruby I/O classes have non-blocking methods (read_nonblock and= write_nonblock). These methods will never block, and if they would block, = they raise an exception instead (IO::WaitReadable or IO::WaitWritable). In = addition, if the IO is at EOF, they raise an EOFError. >=20 > These exceptions are raised repeatedly in virtually every use of the non-= blocking methods. This patch adds a pair of methods (try_read_nonblock and = try_write_nonblock) that have the same semantics as the existing methods, b= ut they return Symbols instead of raising exceptions for these routine case= s: >=20 > * :read_would_block > * :write_would_block > * :eof >=20 > The patch contains updates for IO, StringIO, and OpenSSL. The updates are= fully documented and tested. Bump. Can someone please give feedback? What needs to change in this patch before it can be applied? Thanks! --=20 Aaron Patterson http://tenderlovemaking.com/ --CdrF4e02JqNVZeln Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iQEcBAEBAgAGBQJOyIqGAAoJEJUxcLy0/6/GcDMIAIDkHJ9yckgXi0pZMxnQzL90 O6Fpaoy3a5jJsOKhlUdi/CaYg8VUWPjAjL6vlDaBX+X3OerpoywsKxDsElrAMbpZ QbcE+lW+AXq1CUZMZZdO46r44/jevFhsD87OjAIS0IUZAAldzi6E93JDVOUNFp4Z PRy5gD5v+XeNKs/u+81bX3oXkWIY9J3sk7erwmimy7TR/8x/uJ3zHSVj3rS7klq7 rvxE1sTOGXzejDsig7SK9Ro1GR5vA4xOC28K++WTHgaK3DXF85fJk61sMiZfVIcZ P66OUismi/JVobyCJCxcCTLjvYzyFMIYnfQtOW6FRz03/wwxu0fcSLWg/d6j+yI= =8AOn -----END PGP SIGNATURE----- --CdrF4e02JqNVZeln--