[前][次][番号順一覧][スレッド一覧]

ruby-changes:51037

From: nobu <ko1@a...>
Date: Mon, 23 Apr 2018 11:07:17 +0900 (JST)
Subject: [ruby-changes:51037] nobu:r63244 (trunk): thread_pthread.c: fallback to CLOCK_REALTIME

nobu	2018-04-23 11:07:11 +0900 (Mon, 23 Apr 2018)

  New Revision: 63244

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63244

  Log:
    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]

  Modified files:
    trunk/thread_pthread.c
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 63243)
+++ thread_pthread.c	(revision 63244)
@@ -56,9 +56,9 @@ static struct { https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L56
     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) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L400
 #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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]