summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-09 07:20:00 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-09 07:20:00 +0000
commit3df2fc2da8ee34ad0b923e42b3fcdc8daf391370 (patch)
tree5ad3470d5c77207d92c23f24329280edb82d2541 /io.c
parent44f9d99e3dcbd526b11dc5a693df4f9ca9292618 (diff)
* io.c (io_bufread): removed unnecessary rb_thread_wait_fd().
Patch by Eric Wong. [Bug #6629] [ruby-core:45789] * io.c (rb_io_sysread): ditto. * io.c (copy_stream_fallback_body): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/io.c b/io.c
index b8f6efbe8d..39c922135e 100644
--- a/io.c
+++ b/io.c
@@ -1912,7 +1912,6 @@ io_bufread(char *ptr, long len, rb_io_t *fptr)
}
offset += c;
if ((n -= c) <= 0) break;
- rb_thread_wait_fd(fptr->fd);
}
return len - n;
}
@@ -1923,7 +1922,6 @@ io_bufread(char *ptr, long len, rb_io_t *fptr)
offset += c;
if ((n -= c) <= 0) break;
}
- rb_thread_wait_fd(fptr->fd);
rb_io_check_closed(fptr);
if (io_fillbuf(fptr) < 0) {
break;
@@ -4338,7 +4336,16 @@ rb_io_sysread(int argc, VALUE *argv, VALUE io)
}
n = fptr->fd;
+
+ /*
+ * FIXME: removing rb_thread_wait_fd() here changes sysread semantics
+ * on non-blocking IOs. However, it's still currently possible
+ * for sysread to raise Errno::EAGAIN if another thread read()s
+ * the IO after we return from rb_thread_wait_fd() but before
+ * we call read()
+ */
rb_thread_wait_fd(fptr->fd);
+
rb_io_check_closed(fptr);
io_setstrbuf(&str, ilen);
@@ -9796,7 +9803,6 @@ copy_stream_fallback_body(VALUE arg)
}
else {
ssize_t ss;
- rb_thread_wait_fd(stp->src_fd);
rb_str_resize(buf, buflen);
ss = maygvl_copy_stream_read(1, stp, RSTRING_PTR(buf), l, off);
if (ss == -1)