diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-01 21:56:11 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-01 21:56:11 +0000 |
commit | 832b601e49fd402ec7f30b36a95473131e93ae94 (patch) | |
tree | 63f22ca5f8c77a9e821d486e866f3fada78c4c88 /thread_pthread.c | |
parent | 24c6231e116bb7fd933dbc4a1b3236d8c32a2e31 (diff) |
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 <code@jeremyevans.net>
[ruby-core:87345] [Ruby trunk Bug#14807]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r-- | thread_pthread.c | 5 |
1 files changed, 4 insertions, 1 deletions
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 |