summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-20 14:15:46 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-20 14:15:46 +0000
commit187d2bc1d6e6f3f18a443614406598ed6fc0ef0f (patch)
tree7064a85b8b3082ed49071303b8a8ccc62ce71faf /thread_pthread.c
parent025a2479ae6bc2896e78594a49acd64c32415166 (diff)
* thread_pthread.c (native_cond_initialize): clean up #ifdef condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index f1720e583f..a9c8fa68fb 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -46,7 +46,8 @@ static pthread_t timer_thread_id;
#define RB_CONDATTR_CLOCK_MONOTONIC 1
#if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && defined(HAVE_CLOCKID_T) && \
- defined(CLOCK_REALTIME) && defined(CLOCK_MONOTONIC) && defined(HAVE_CLOCK_GETTIME)
+ defined(CLOCK_REALTIME) && defined(CLOCK_MONOTONIC) && \
+ defined(HAVE_CLOCK_GETTIME) && defined(HAVE_PTHREAD_CONDATTR_INIT)
#define USE_MONOTONIC_COND 1
#else
#define USE_MONOTONIC_COND 0
@@ -248,12 +249,11 @@ native_cond_initialize(rb_thread_cond_t *cond, int flags)
{
#ifdef HAVE_PTHREAD_COND_INIT
int r;
-# ifdef HAVE_PTHREAD_CONDATTR_INIT
+# if USE_MONOTONIC_COND
pthread_condattr_t attr;
pthread_condattr_init(&attr);
-# if USE_MONOTONIC_COND
cond->clockid = CLOCK_REALTIME;
if (flags & RB_CONDATTR_CLOCK_MONOTONIC) {
r = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
@@ -261,7 +261,6 @@ native_cond_initialize(rb_thread_cond_t *cond, int flags)
cond->clockid = CLOCK_MONOTONIC;
}
}
-# endif
r = pthread_cond_init(&cond->cond, &attr);
# else