* 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
This commit is contained in:
kosaki 2012-09-09 07:20:00 +00:00
Родитель 44f9d99e3d
Коммит 3df2fc2da8
2 изменённых файлов: 16 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Sun Sep 9 16:08:48 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* 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.
Sun Sep 9 15:21:52 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* thread.c (rb_mutex_lock): stop multiple threads use

12
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)