From 1bdf1a5c6f53fa834c10704bd9b60f6c0c375328 Mon Sep 17 00:00:00 2001 From: kosaki Date: Tue, 27 Sep 2011 00:59:04 +0000 Subject: [PATCH] * thread_pthread.c: make native_fd_select(). * thread.c (do_select): remove #ifdef _WIN32. Instead, use native_fd_select() always. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ thread.c | 14 ++------------ thread_pthread.c | 6 ++++++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9dab2e342..27b7c32fd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Sep 27 09:55:40 2011 KOSAKI Motohiro + + * thread_pthread.c: make native_fd_select(). + * thread.c (do_select): remove #ifdef _WIN32. Instead, use + native_fd_select() always. + Tue Sep 27 09:44:59 2011 KOSAKI Motohiro * thread.c (do_select): remove cygwin specific hack. It's layer diff --git a/thread.c b/thread.c index 3734cc2af2..4f9d09534d 100644 --- a/thread.c +++ b/thread.c @@ -2529,6 +2529,7 @@ do_select(int n, rb_fdset_t *read, rb_fdset_t *write, rb_fdset_t *except, rb_fdset_t UNINITIALIZED_VAR(orig_except); double limit = 0; struct timeval wait_rest; + rb_thread_t *th = GET_THREAD(); if (timeout) { limit = timeofday(); @@ -2547,21 +2548,10 @@ do_select(int n, rb_fdset_t *read, rb_fdset_t *write, rb_fdset_t *except, retry: lerrno = 0; -#if defined(_WIN32) - { - rb_thread_t *th = GET_THREAD(); - BLOCKING_REGION({ + 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); - if (result < 0) lerrno = errno; - }, ubf_select, GET_THREAD()); -#endif - errno = lerrno; if (result < 0) { diff --git a/thread_pthread.c b/thread_pthread.c index afc86ca035..de730f10ff 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -856,6 +856,12 @@ native_thread_apply_priority(rb_thread_t *th) #endif /* USE_NATIVE_THREAD_PRIORITY */ +static int +native_fd_select(int n, rb_fdset_t *readfds, rb_fdset_t *writefds, rb_fdset_t *exceptfds, struct timeval *timeout, rb_thread_t *th) +{ + return rb_fd_select(n, readfds, writefds, exceptfds, timeout); +} + static void ubf_pthread_cond_signal(void *ptr) {