summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-23 02:07:11 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-23 02:07:11 (GMT)
commit1222560ad17a3502cec5043de2549e8e82031ff3 (patch)
tree09645dbca3d1aa5e243ab305d0c06f811da26333 /thread_pthread.c
parentc4056a4a702cb2e73d882ffa0729b66797660a18 (diff)
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
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index 4a39682..6337620 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);