summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c5
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