From 832b601e49fd402ec7f30b36a95473131e93ae94 Mon Sep 17 00:00:00 2001 From: normal Date: Fri, 1 Jun 2018 21:56:11 +0000 Subject: Initialize condattr_monotonic via pthread_condattr_init Some operating systems will work without calling pthread_condattr_init, but some won't (such as OpenBSD). Prior to r63238, pthread_condattr_init was always called before calling pthread_condattr_setclock. From: Jeremy Evans [ruby-core:87345] [Ruby trunk Bug#14807] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_pthread.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/thread_pthread.c b/thread_pthread.c index e17ca36819..069c50ed7a 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -399,7 +399,10 @@ 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); + int r = pthread_condattr_init(condattr_monotonic); + if (r == 0) { + r = pthread_condattr_setclock(condattr_monotonic, CLOCK_MONOTONIC); + } if (r) condattr_monotonic = NULL; } #endif -- cgit v1.2.3