Index: include/ruby/intern.h =================================================================== --- include/ruby/intern.h (revision 23101) +++ include/ruby/intern.h (working copy) @@ -213,6 +213,7 @@ void rb_fd_clr(int, rb_fdset_t *); int rb_fd_isset(int, const rb_fdset_t *); void rb_fd_copy(rb_fdset_t *, const fd_set *, int); +void rb_fd_resize(int, rb_fdset_t *); int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *); #define rb_fd_ptr(f) ((f)->fdset) @@ -231,6 +232,7 @@ void rb_fd_set(int, rb_fdset_t *); #define rb_fd_clr(n, f) rb_w32_fdclr(n, (f)->fdset) #define rb_fd_isset(n, f) rb_w32_fdisset(n, (f)->fdset) +#define rb_fd_resize(n, f) (void)(f) #define rb_fd_select(n, rfds, wfds, efds, timeout) rb_w32_select(n, (rfds) ? ((rb_fdset_t*)rfds)->fdset : NULL, (wfds) ? ((rb_fdset_t*)wfds)->fdset : NULL, (efds) ? ((rb_fdset_t*)efds)->fdset: NULL, timeout) #define rb_fd_ptr(f) ((f)->fdset) @@ -244,6 +246,7 @@ #define rb_fd_clr(n, f) FD_CLR(n, f) #define rb_fd_isset(n, f) FD_ISSET(n, f) #define rb_fd_copy(d, s, n) (*(d) = *(s)) +#define rb_fd_resize(n, f) (void)(f) #define rb_fd_ptr(f) (f) #define rb_fd_init(f) FD_ZERO(f) #define rb_fd_term(f) (void)(f) Index: io.c =================================================================== --- io.c (revision 23101) +++ io.c (working copy) @@ -6696,6 +6696,10 @@ ep = 0; } + if (rp) { rb_fd_resize(max, &fds[0]); rp = rb_fd_ptr(&fds[0]); } + if (wp) { rb_fd_resize(max, &fds[1]); wp = rb_fd_ptr(&fds[1]); } + if (ep) { rb_fd_resize(max, &fds[2]); ep = rb_fd_ptr(&fds[2]); } + max++; n = rb_thread_select(max, rp, wp, ep, tp); Index: thread.c =================================================================== --- thread.c (revision 23101) +++ thread.c (working copy) @@ -2174,7 +2174,7 @@ } } -static void +void rb_fd_resize(int n, rb_fdset_t *fds) { int m = howmany(n + 1, NFDBITS) * sizeof(fd_mask);