diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-30 20:27:21 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-08-30 20:27:21 +0000 |
commit | b1ab5d1b424de2c493706e56ed192ee5b95d59ea (patch) | |
tree | 2d9c00fbff9bf61e9320e797f52fc46fde4a4f04 /win32 | |
parent | ee56dd160e410e2a44ae7d861b8520810f957416 (diff) |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c index 4d3080663b..5e4ea6db4e 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2368,6 +2368,21 @@ rb_w32_fdisset(int fd, fd_set *set) } 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 @@ rb_w32_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src) 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; } // |