ruby-changes:21085
From: kosaki <ko1@a...>
Date: Wed, 31 Aug 2011 05:27:32 +0900 (JST)
Subject: [ruby-changes:21085] kosaki:r33134 (ruby_1_9_3): merge revision(s) 33128:
kosaki 2011-08-31 05:27:21 +0900 (Wed, 31 Aug 2011) New Revision: 33134 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33134 Log: merge revision(s) 33128: * win32/win32.c, include/ruby/intern.h (rb_w32_fd_copy): implement for rb_thread_select() in thread.c. the use of rb_fd_copy() is introduced in r33117. [Bug #5229] [ruby-core:39102] * thread.c (rb_thread_select): must call rb_fd_init() before using rb_fdset_t. see the implementations of rb_fd_init()s if you want to know the reason. Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/include/ruby/intern.h branches/ruby_1_9_3/thread.c branches/ruby_1_9_3/version.h branches/ruby_1_9_3/win32/win32.c Index: ruby_1_9_3/include/ruby/intern.h =================================================================== --- ruby_1_9_3/include/ruby/intern.h (revision 33133) +++ ruby_1_9_3/include/ruby/intern.h (revision 33134) @@ -270,6 +270,8 @@ 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_copy(d, s, n) rb_w32_fd_copy((d), (s), (n)) +void rb_w32_fd_copy(rb_fdset_t *, const fd_set *, int); #define rb_fd_dup(d, s) rb_w32_fd_dup((d), (s)) void rb_w32_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src); #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)) Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 33133) +++ ruby_1_9_3/ChangeLog (revision 33134) @@ -1,3 +1,14 @@ +Wed Aug 31 05:26:30 2011 NAKAMURA Usaku <usa@r...> + + * win32/win32.c, include/ruby/intern.h (rb_w32_fd_copy): implement + for rb_thread_select() in thread.c. the use of rb_fd_copy() is + introduced in r33117. + [Bug #5229] [ruby-core:39102] + + * thread.c (rb_thread_select): must call rb_fd_init() before using + rb_fdset_t. see the implementations of rb_fd_init()s if you want to + know the reason. + Tue Aug 30 11:25:21 2011 NARUSE, Yui <naruse@r...> * ext/json: Merge json gem 1.5.4+ (2149f4185c598fb97db1). Index: ruby_1_9_3/thread.c =================================================================== --- ruby_1_9_3/thread.c (revision 33133) +++ ruby_1_9_3/thread.c (revision 33134) @@ -2682,7 +2682,7 @@ rb_thread_select(int max, fd_set * read, fd_set * write, fd_set * except, struct timeval *timeout) { - rb_fdset_t fdsets[3] = { 0 }; + rb_fdset_t fdsets[3]; rb_fdset_t *rfds = NULL; rb_fdset_t *wfds = NULL; rb_fdset_t *efds = NULL; @@ -2690,14 +2690,17 @@ if (read) { rfds = &fdsets[0]; + rb_fd_init(rfds); rb_fd_copy(rfds, read, max); } if (write) { wfds = &fdsets[1]; + rb_fd_init(wfds); rb_fd_copy(wfds, write, max); } if (except) { efds = &fdsets[2]; + rb_fd_init(wfds); rb_fd_copy(efds, except, max); } Index: ruby_1_9_3/win32/win32.c =================================================================== --- ruby_1_9_3/win32/win32.c (revision 33133) +++ ruby_1_9_3/win32/win32.c (revision 33134) @@ -2368,6 +2368,21 @@ } void +rb_w32_fd_copy(rb_fdset_t *dst, const fd_set *src, int max) +{ + max = min(src->fd_count, max); + if ((UINT)dst->capa < max) { + dst->capa = (src->fd_count / FD_SETSIZE + 1) * FD_SETSIZE; + dst->fdset = xrealloc(dst->fdset, sizeof(unsigned int) + sizeof(SOCKET) * dst->capa); + } + + memcpy(dst->fdset->fd_array, src->fd_array, + max * sizeof(src->fd_array[0])); + dst->fdset->fd_count = src->fd_count; +} + +/* License: Ruby's */ +void rb_w32_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src) { if ((UINT)dst->capa < src->fdset->fd_count) { @@ -2377,6 +2392,7 @@ memcpy(dst->fdset->fd_array, src->fdset->fd_array, src->fdset->fd_count * sizeof(src->fdset->fd_array[0])); + dst->fdset->fd_count = src->fdset->fd_count; } // Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 33133) +++ ruby_1_9_3/version.h (revision 33134) @@ -1,10 +1,10 @@ #define RUBY_VERSION "1.9.3" #define RUBY_PATCHLEVEL -1 -#define RUBY_RELEASE_DATE "2011-08-30" +#define RUBY_RELEASE_DATE "2011-08-31" #define RUBY_RELEASE_YEAR 2011 #define RUBY_RELEASE_MONTH 8 -#define RUBY_RELEASE_DAY 30 +#define RUBY_RELEASE_DAY 31 #include "ruby/version.h" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/