From 6227816910c2d125193bb4c6bb044e7bca91bec6 Mon Sep 17 00:00:00 2001 From: yugui Date: Thu, 15 Jan 2009 15:37:20 +0000 Subject: merges r21487 from trunk into ruby_1_9_1. * include/ruby/intern.h, thread.c, win32/Makefile.sub (rb_fdset_t, rb_fd_init, rb_fd_term, rb_fd_zero, rb_fd_set, rb_fd_clr, rb_fd_isset, rb_fd_select, rb_fd_ptr, rb_fd_max, HAVE_RB_FD_INIT): new type, functions, and macros for Windows. * win32/win32.c (extract_fd, rb_w32_select): use rb_fdset_t to expand fd_array if needed. [ruby-core:19946] * win32/win32.c (copy_fd): new funcion for rb_w32_select(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/intern.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include') diff --git a/include/ruby/intern.h b/include/ruby/intern.h index dc2e1325ac..0e282c6790 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -218,6 +218,24 @@ int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval * #define rb_fd_ptr(f) ((f)->fdset) #define rb_fd_max(f) ((f)->maxfd) +#elif defined(_WIN32) + +typedef struct { + int capa; + fd_set *fdset; +} rb_fdset_t; + +void rb_fd_init(volatile rb_fdset_t *); +void rb_fd_term(rb_fdset_t *); +#define rb_fd_zero(f) ((f)->fdset->fd_count = 0) +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_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) +#define rb_fd_max(f) ((f)->fdset->fd_count) + #else typedef fd_set rb_fdset_t; -- cgit v1.2.3