From 1222560ad17a3502cec5043de2549e8e82031ff3 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 23 Apr 2018 02:07:11 +0000 Subject: thread_pthread.c: fallback to CLOCK_REALTIME * thread_pthread.c (Init_native_thread): fallback to the default CLOCK_REALTIME when failed to set to CLOCK_MONOTONIC, e.g. on Solaris. [Misc #14497] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_pthread.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'thread_pthread.c') diff --git a/thread_pthread.c b/thread_pthread.c index 4a39682dff..6337620e8a 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -56,9 +56,9 @@ static struct { defined(CLOCK_REALTIME) && defined(CLOCK_MONOTONIC) && \ defined(HAVE_CLOCK_GETTIME) static pthread_condattr_t condattr_mono; -static pthread_condattr_t *const condattr_monotonic = &condattr_mono; +static pthread_condattr_t *condattr_monotonic = &condattr_mono; #else -static const void *condattr_monotonic; +static const void *const condattr_monotonic = NULL; #endif #if defined(HAVE_POLL) && defined(HAVE_FCNTL) && defined(F_GETFL) && defined(F_SETFL) && defined(O_NONBLOCK) @@ -400,7 +400,7 @@ Init_native_thread(rb_thread_t *th) #if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) if (condattr_monotonic) { int r = pthread_condattr_setclock(condattr_monotonic, CLOCK_MONOTONIC); - if (r) rb_bug_errno("pthread_condattr_setclock", r); + if (r) condattr_monotonic = NULL; } #endif pthread_key_create(&ruby_native_thread_key, NULL); -- cgit v1.2.3