diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-12 06:10:21 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-12 06:10:21 +0000 |
commit | a60e00fde84929b2b5b3943107ce2bae3db14935 (patch) | |
tree | 28c83bb96111a7d038a477f54c10969385bbd83c /ext/io/wait | |
parent | 1baa57b00331e5bedd6253dbf4dadc490a480f81 (diff) | |
download | ruby-a60e00fde84929b2b5b3943107ce2bae3db14935.tar.gz |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/io/wait')
-rw-r--r-- | ext/io/wait/wait.c | 18 |
1 files changed, 8 insertions, 10 deletions
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; } |