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

ruby-changes:50157

From: nobu <ko1@a...>
Date: Wed, 7 Feb 2018 15:15:03 +0900 (JST)
Subject: [ruby-changes:50157] nobu:r62275 (trunk): fix up r62272

nobu	2018-02-07 15:14:56 +0900 (Wed, 07 Feb 2018)

  New Revision: 62275

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

  Log:
    fix up r62272
    
    * thread.c (timeval_for): tv_usec is suseconds_t which may be
      smaller than long.
    
    * thread_pthread.c (native_cond_timeout): ret is now used in
      CLOCK_MONOTONIC case only.

  Modified files:
    trunk/thread.c
    trunk/thread_pthread.c
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 62274)
+++ thread_pthread.c	(revision 62275)
@@ -365,13 +365,12 @@ native_cond_timedwait(rb_nativethread_co https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L365
 static struct timespec
 native_cond_timeout(rb_nativethread_cond_t *cond, struct timespec timeout_rel)
 {
-    int ret;
     struct timespec timeout;
     struct timespec now;
 
 #if USE_MONOTONIC_COND
     if (cond->clockid == CLOCK_MONOTONIC) {
-	ret = clock_gettime(cond->clockid, &now);
+	int ret = clock_gettime(cond->clockid, &now);
 	if (ret != 0)
 	    rb_sys_fail("clock_gettime()");
 	goto out;
Index: thread.c
===================================================================
--- thread.c	(revision 62274)
+++ thread.c	(revision 62275)
@@ -225,7 +225,7 @@ timeval_for(struct timeval *tv, const st https://github.com/ruby/ruby/blob/trunk/thread.c#L225
 {
     if (tv && ts) {
         tv->tv_sec = ts->tv_sec;
-        tv->tv_usec = ts->tv_nsec / 1000;
+        tv->tv_usec = (suseconds_t)(ts->tv_nsec / 1000);
         return tv;
     }
     return 0;

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

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