Project

General

Profile

Bug #6629 ยป 0001-io.c-avoid-rb_thread_wait_fd-if-we-may-call-rb_io_wa.patch

normalperson (Eric Wong), 06/23/2012 12:04 PM

View differences:

io.c
}
offset += c;
if ((n -= c) <= 0) break;
rb_thread_wait_fd(fptr->fd);
}
return len - n;
}
......
offset += c;
if ((n -= c) <= 0) break;
}
rb_thread_wait_fd(fptr->fd);
rb_io_check_closed(fptr);
if (io_fillbuf(fptr) < 0) {
break;
......
}
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);
......
}
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)
    (1-1/1)