mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
2cc5eeaf6c
commit
1bdf1a5c6f
3 changed files with 14 additions and 12 deletions
|
@ -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>
|
Tue Sep 27 09:44:59 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* thread.c (do_select): remove cygwin specific hack. It's layer
|
* thread.c (do_select): remove cygwin specific hack. It's layer
|
||||||
|
|
14
thread.c
14
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);
|
rb_fdset_t UNINITIALIZED_VAR(orig_except);
|
||||||
double limit = 0;
|
double limit = 0;
|
||||||
struct timeval wait_rest;
|
struct timeval wait_rest;
|
||||||
|
rb_thread_t *th = GET_THREAD();
|
||||||
|
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
limit = timeofday();
|
limit = timeofday();
|
||||||
|
@ -2547,21 +2548,10 @@ do_select(int n, rb_fdset_t *read, rb_fdset_t *write, rb_fdset_t *except,
|
||||||
retry:
|
retry:
|
||||||
lerrno = 0;
|
lerrno = 0;
|
||||||
|
|
||||||
#if defined(_WIN32)
|
BLOCKING_REGION({
|
||||||
{
|
|
||||||
rb_thread_t *th = GET_THREAD();
|
|
||||||
BLOCKING_REGION({
|
|
||||||
result = native_fd_select(n, read, write, except, timeout, th);
|
result = native_fd_select(n, read, write, except, timeout, th);
|
||||||
if (result < 0) lerrno = errno;
|
if (result < 0) lerrno = errno;
|
||||||
}, ubf_select, th);
|
}, 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;
|
errno = lerrno;
|
||||||
|
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
|
|
@ -856,6 +856,12 @@ native_thread_apply_priority(rb_thread_t *th)
|
||||||
|
|
||||||
#endif /* USE_NATIVE_THREAD_PRIORITY */
|
#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
|
static void
|
||||||
ubf_pthread_cond_signal(void *ptr)
|
ubf_pthread_cond_signal(void *ptr)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue