e$B1sF#$G$9!#e(B
e$BC10l%9%l%C%I$N>uBV$Ge(B TCPServer#gets e$B$r8F$V$He(B Errno::ENOTCONN
e$B$,e(B
e$BEj$2$i$l$^$9$,!“J#?t$N%9%l%C%I$,$$$k>uBV$@$H@\B3$,$”$k$^$G%V%m%C%/e(B
e$B$7$^$9!#e(B
Thread.new { sleep }
TCPServer.new(0).gets
rubyspec e$B$,$=$&$$$&%F%9%H$rF~$l$F$/$l$?$N$G:$$C$F$^$9!#e(B
e$B860x$Oe(B gets e$B$,FI$9~$$r9T$&A0$Ke(B (rb_thread_wait_fd
e$B7PM3$Ge(B) select
e$B$r9T$&$3$H$G$9!#e(B
io.c e$B$Ne(B READ_CHECK e$B$NCf$Ge(B rb_thread_wait_fd
e$B$r8F$VI,MW$O$"$k$N$Ge(B
e$B$7$g$&$+!#!Ve(Bwindows e$B$GI,MW!W$H$Ne(B akr
e$B$5$s$N$*9p$2$,$"$C$?$N$G!"e(B
WIN32 e$B0J30$G$O8F$P$J$$$h$&$K$9$k%Q%C%A$r:n$C$F$$^$7$?!#e(B
make check e$B$He(B test-rubyspec e$B$G$OLdBj$,8+$D$+$j$^$;$s$G$7$?!#e(B
e$B@53N$K$Oe(B 2
e$B$D$[$I%F%9%H$,<:GT$7$^$9$,!"`tKv$JLdBj$J$N$G!"$A$g$C$He(B
e$B=$@5$9$l$PD>$;$^$9!#$I$&$G$7$g$&!#e(B
diff --git a/io.c b/io.c
index 4017778…8b68603 100644
— a/io.c
+++ b/io.c
@@ -175,9 +175,15 @@ static int max_file_descriptor = NOFILE;
#define READ_DATA_PENDING_PTR(fptr) ((fptr)->rbuf+(fptr)->rbuf_off)
#define READ_DATA_BUFFERED(fptr) READ_DATA_PENDING(fptr)
+#if defined(_WIN32)
+#define WAIT_FD_IN_WIN32(fptr) rb_thread_wait_fd((fptr)->fd);
+#else
+#define WAIT_FD_IN_WIN32(fptr) ;
+#endif
+
#define READ_CHECK(fptr) do {
if (!READ_DATA_PENDING(fptr)) {\
- rb_thread_wait_fd((fptr)->fd);\
-
WAIT_FD_IN_WIN32(fptr);
rb_io_check_closed(fptr);
}
} while(0)
@@ -1637,8 +1643,7 @@ fill_cbuf(rb_io_t *fptr, int ec_flags)if (res == econv_source_buffer_empty) { if (fptr->rbuf_len == 0) {
-
rb_thread_wait_fd(fptr->fd);
-
rb_io_check_closed(fptr);
- READ_CHECK(fptr);
if (io_fillbuf(fptr) == -1) {
ds = dp = (unsigned char *)fptr->cbuf +
fptr->cbuf_off + fptr->cbuf_len;
de = (unsigned char *)fptr->cbuf + fptr->cbuf_capa;
@@ -2228,8 +2233,7 @@ appendline(rb_io_t *fptr, int delim, VALUE
*strp, long *lp)
if (limit == 0)
return (unsigned char)RSTRING_PTR(str)[RSTRING_LEN(str)-1];
}
- rb_thread_wait_fd(fptr->fd);
- rb_io_check_closed(fptr);
- READ_CHECK(fptr);
} while (io_fillbuf(fptr) >= 0);
*lp = limit;
return EOF;
@@ -2251,8 +2255,7 @@ swallow(rb_io_t fptr, int term)
if (!read_buffered_data(buf, cnt - i, fptr)) / must not fail */
rb_sys_fail_path(fptr->pathv);
}
- rb_thread_wait_fd(fptr->fd);
- rb_io_check_closed(fptr);
- READ_CHECK(fptr);
} while (io_fillbuf(fptr) == 0);
return FALSE;
}
@@ -2290,8 +2293,7 @@ rb_io_getline_fast(rb_io_t *fptr, rb_encoding
*enc)
pos = rb_str_coderange_scan_restartable(RSTRING_PTR(str) + pos,
RSTRING_PTR(str) + len, enc, &cr);
if (e) break;
}
- rb_thread_wait_fd(fptr->fd);
- rb_io_check_closed(fptr);
- READ_CHECK(fptr);
if (io_fillbuf(fptr) < 0) {
if (NIL_P(str)) return Qnil;
break;