Skip to content

Commit

Permalink
* thread_pthread.c: make native_fd_select().
Browse files Browse the repository at this point in the history
* 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
kosaki committed Sep 27, 2011
1 parent 2cc5eea commit 1bdf1a5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 2 additions & 12 deletions thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions thread_pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 1bdf1a5

Please sign in to comment.