diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-15 18:04:13 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-15 18:04:13 +0000 |
commit | a8bdd28d10c2c5981e944e945eed95f6c4ad44bc (patch) | |
tree | ed9f4c66c96113c5832cbc2d0da018ef6af31ce4 /thread.c | |
parent | 3eb1b472e26d65664b96ca261891cebada6fa03f (diff) | |
download | ruby-a8bdd28d10c2c5981e944e945eed95f6c4ad44bc.tar.gz |
* thread.c (do_select): Windows: no need to poll if select(2) is
cancelable.
* thread_win32.c (native_fd_select): new function to make select(2)
cancelable.
* thread_win32.c (rb_w32_check_interrupt): new function for checking
interrupt.
* win32/win32.c (rb_w32_select_with_thread): new function. cancelable
select(2).
* win32/win32.c (rb_w32_select): use above function internally.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -2537,7 +2537,7 @@ do_select(int n, rb_fdset_t *read, rb_fdset_t *write, rb_fdset_t *except, # endif if (timeout) { -# if defined(__CYGWIN__) || defined(_WIN32) +# if defined(__CYGWIN__) gettimeofday(&start_time, NULL); limit = (double)start_time.tv_sec + (double)start_time.tv_usec*1e-6; # else @@ -2558,7 +2558,7 @@ do_select(int n, rb_fdset_t *read, rb_fdset_t *write, rb_fdset_t *except, retry: lerrno = 0; -#if defined(__CYGWIN__) || defined(_WIN32) +#if defined(__CYGWIN__) { int finish = 0; /* polling duration: 100ms */ @@ -2595,6 +2595,14 @@ do_select(int n, rb_fdset_t *read, rb_fdset_t *write, rb_fdset_t *except, }, 0, 0); } while (result == 0 && !finish); } +#elif defined(_WIN32) + { + rb_thread_t *th = GET_THREAD(); + BLOCKING_REGION({ + result = native_fd_select(n, read, write, except, timeout, th); + if (result < 0) lerrno = errno; + }, ubf_select, th); + } #else BLOCKING_REGION({ result = rb_fd_select(n, read, write, except, timeout); |