* win32/win32.c, include/ruby/win32.h (rb_w32_has_cancel_io): new

function.

* io.c (WAIT_FD_IN_WIN32): check only when it's not cancelable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2010-05-10 05:02:44 +00:00
parent 1538119662
commit fe0d339c2c
3 changed files with 10 additions and 2 deletions

View File

@ -222,6 +222,7 @@ struct msghdr {
extern int rb_w32_cmdvector(const char *, char ***);
extern rb_pid_t rb_w32_pipe_exec(const char *, const char *, int, int *, int *);
extern int flock(int fd, int oper);
extern int rb_w32_has_cancel_io(void);
extern int rb_w32_is_socket(int);
extern int WSAAPI rb_w32_accept(int, struct sockaddr *, int *);
extern int WSAAPI rb_w32_bind(int, const struct sockaddr *, int);

5
io.c
View File

@ -189,9 +189,10 @@ static int max_file_descriptor = NOFILE;
#define READ_CHAR_PENDING(fptr) ((fptr)->cbuf_len)
#if defined(_WIN32)
#define WAIT_FD_IN_WIN32(fptr) rb_thread_wait_fd((fptr)->fd);
#define WAIT_FD_IN_WIN32(fptr) \
(rb_w32_has_cancel_io() ? 0 : rb_thread_wait_fd((fptr)->fd))
#else
#define WAIT_FD_IN_WIN32(fptr) ;
#define WAIT_FD_IN_WIN32(fptr)
#endif
#define READ_CHECK(fptr) do {\

View File

@ -559,6 +559,12 @@ init_env(void)
typedef BOOL (WINAPI *cancel_io_t)(HANDLE);
static cancel_io_t cancel_io = NULL;
int
rb_w32_has_cancel_io(void)
{
return cancel_io != NULL;
}
static void
init_func(void)
{