ruby-changes:38182
From: nobu <ko1@a...>
Date: Sun, 12 Apr 2015 23:12:50 +0900 (JST)
Subject: [ruby-changes:38182] nobu:r50263 (trunk): wait.c: no EOF
nobu 2015-04-12 15:10:21 +0900 (Sun, 12 Apr 2015) New Revision: 50263 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50263 Log: wait.c: no EOF * ext/io/wait/wait.c (io_wait_readable): simply returns that IO is readable without blocking, but no longer returns EOF. Modified files: trunk/ChangeLog trunk/ext/io/wait/wait.c Index: ChangeLog =================================================================== --- ChangeLog (revision 50262) +++ ChangeLog (revision 50263) @@ -1,4 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 -Sun Apr 12 15:08:13 2015 Nobuyoshi Nakada <nobu@r...> +Sun Apr 12 15:10:18 2015 Nobuyoshi Nakada <nobu@r...> + + * ext/io/wait/wait.c (io_wait_readable): simply returns that IO is + readable without blocking, but no longer returns EOF. * ext/io/wait/wait.c (io_ready_p, io_wait_readable): try polling first and check FIONREAD optionally to see if EOF. Index: ext/io/wait/wait.c =================================================================== --- ext/io/wait/wait.c (revision 50262) +++ ext/io/wait/wait.c (revision 50263) @@ -117,13 +117,14 @@ io_ready_p(VALUE io) https://github.com/ruby/ruby/blob/trunk/ext/io/wait/wait.c#L117 /* * call-seq: - * io.wait -> IO, true, false or nil - * io.wait(timeout) -> IO, true, false or nil - * io.wait_readable -> IO, true, false or nil - * io.wait_readable(timeout) -> IO, true, false or nil + * io.wait -> IO, true or nil + * io.wait(timeout) -> IO, true or nil + * io.wait_readable -> IO, true or nil + * io.wait_readable(timeout) -> IO, true or nil * - * Waits until input is available or times out and returns self or nil when - * EOF is reached. + * Waits until IO is readable without blocking and returns +self+, or + * +nil+ when times out. + * Returns +true+ immediately when buffered data is available. */ static VALUE @@ -138,10 +139,7 @@ io_wait_readable(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ext/io/wait/wait.c#L139 tv = get_timeout(argc, argv, &timerec); if (rb_io_read_pending(fptr)) return Qtrue; if (wait_for_single_fd(fptr, RB_WAITFD_IN, tv)) { - ioctl_arg n; - if (!FIONREAD_POSSIBLE_P(fptr->fd)) return io; - if (ioctl(fptr->fd, FIONREAD, &n)) rb_sys_fail(0); - if (n > 0) return io; + return io; } return Qnil; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/