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

ruby-changes:50368

From: normal <ko1@a...>
Date: Mon, 19 Feb 2018 18:29:05 +0900 (JST)
Subject: [ruby-changes:50368] normal:r62484 (trunk): thread_pthread.c: fix thread cache for non-monotonic clock

normal	2018-02-19 18:28:51 +0900 (Mon, 19 Feb 2018)

  New Revision: 62484

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

  Log:
    thread_pthread.c: fix thread cache for non-monotonic clock
    
    I noticed this because of https://bugs.ruby-lang.org/issues/14494

  Modified files:
    trunk/thread_pthread.c
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 62483)
+++ thread_pthread.c	(revision 62484)
@@ -894,15 +894,13 @@ thread_cache_reset(void) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L894
 static rb_thread_t *
 register_cached_thread_and_wait(rb_nativethread_id_t thread_self_id)
 {
-    struct timespec end;
+    struct timespec end = { 60, 0 };
     struct cached_thread_entry entry;
 
     rb_native_cond_initialize(&entry.cond, RB_CONDATTR_CLOCK_MONOTONIC);
     entry.th = NULL;
     entry.thread_id = thread_self_id;
-
-    getclockofday(&end);
-    end.tv_sec += 60;
+    end = native_cond_timeout(&entry.cond, end);
 
     rb_native_mutex_lock(&thread_cache_lock);
     {

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

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