summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-30 15:04:11 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-30 15:04:11 +0000
commitee7d523631de5755a1b4d8ee1fe8ab8a15edfcde (patch)
tree499adb60dd741f41fa404179e4c052b4cb278e33 /win32
parent527be1b25a3192fffa143ef4bb520c9812e8324d (diff)
* 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/trunk@33128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 9f86e7c850..5cafb4a416 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2468,6 +2468,21 @@ rb_w32_fdisset(int fd, fd_set *set)
/* License: Ruby's */
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) {
@@ -2477,6 +2492,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;
}
//