summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/io/wait/wait.c18
2 files changed, 12 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 63443a5510..de3d993a06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
-Sun Apr 12 15:08:13 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Apr 12 15:10:18 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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.
diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c
index c48104f16d..99435460d4 100644
--- a/ext/io/wait/wait.c
+++ b/ext/io/wait/wait.c
@@ -117,13 +117,14 @@ io_ready_p(VALUE io)
/*
* 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, VALUE io)
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;
}