summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-04 01:31:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-04 01:31:48 +0000
commit0718f53bca25499fdce5af023c9177664a68be7a (patch)
treeb1332f99d979337a97d5856fa71de0f823273d5a
parent05c18139a1545a61caaaf33d888c8427d346b571 (diff)
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
-rw-r--r--thread.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/thread.c b/thread.c
index 1f699f6bdac..cc8f5a8dac5 100644
--- a/thread.c
+++ b/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. */