Permalink
Browse files

* 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
  • Loading branch information...
1 parent 2cc5eea commit 1bdf1a5c6f53fa834c10704bd9b60f6c0c375328 @kosaki kosaki committed Sep 27, 2011
Showing with 14 additions and 12 deletions.
  1. +6 −0 ChangeLog
  2. +2 −12 thread.c
  3. +6 −0 thread_pthread.c
View
@@ -1,3 +1,9 @@
+Tue Sep 27 09:55:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * 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 <kosaki.motohiro@gmail.com>
* thread.c (do_select): remove cygwin specific hack. It's layer
View
@@ -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) {
View
@@ -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)
{

0 comments on commit 1bdf1a5

Please sign in to comment.