mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
thread.c: timespec_for is used only if poll() is used
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
05c18139a1
commit
0718f53bca
1 changed files with 11 additions and 9 deletions
20
thread.c
20
thread.c
|
@ -200,6 +200,16 @@ vm_living_thread_num(rb_vm_t *vm)
|
|||
return vm->living_thread_num;
|
||||
}
|
||||
|
||||
/*
|
||||
* poll() is supported by many OSes, but so far Linux is the only
|
||||
* one we know of that supports using poll() in all places select()
|
||||
* would work.
|
||||
*/
|
||||
#if defined(HAVE_POLL) && defined(__linux__)
|
||||
# define USE_POLL
|
||||
#endif
|
||||
|
||||
#ifdef USE_POLL
|
||||
static inline struct timespec *
|
||||
timespec_for(struct timespec *ts, const struct timeval *tv)
|
||||
{
|
||||
|
@ -210,6 +220,7 @@ timespec_for(struct timespec *ts, const struct timeval *tv)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if THREAD_DEBUG
|
||||
#ifdef HAVE_VA_ARGS_MACRO
|
||||
|
@ -3879,15 +3890,6 @@ rb_thread_fd_select(int max, rb_fdset_t * read, rb_fdset_t * write, rb_fdset_t *
|
|||
return do_select(max, read, write, except, timeout);
|
||||
}
|
||||
|
||||
/*
|
||||
* poll() is supported by many OSes, but so far Linux is the only
|
||||
* one we know of that supports using poll() in all places select()
|
||||
* would work.
|
||||
*/
|
||||
#if defined(HAVE_POLL) && defined(__linux__)
|
||||
# define USE_POLL
|
||||
#endif
|
||||
|
||||
#ifdef USE_POLL
|
||||
|
||||
/* The same with linux kernel. TODO: make platform independent definition. */
|
||||
|
|
Loading…
Reference in a new issue