mirror of
https://github.com/ruby/ruby.git
synced 2025-09-20 19:14:00 +02:00
* 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/trunk@21487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e41bd61822
commit
50258b19fd
5 changed files with 139 additions and 39 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue