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

ruby-changes:14569

From: usa <ko1@a...>
Date: Mon, 25 Jan 2010 23:10:04 +0900 (JST)
Subject: [ruby-changes:14569] Ruby:r26409 (trunk): * thread.c (do_select): wrong conditions.

usa	2010-01-25 23:09:46 +0900 (Mon, 25 Jan 2010)

  New Revision: 26409

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26409

  Log:
    * thread.c (do_select): wrong conditions.  [ruby-core:27753]

  Modified files:
    trunk/ChangeLog
    trunk/thread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 26408)
+++ ChangeLog	(revision 26409)
@@ -1,3 +1,7 @@
+Mon Jan 25 23:08:10 2010  NAKAMURA Usaku  <usa@r...>
+
+	* thread.c (do_select): wrong conditions.  [ruby-core:27753]
+
 Mon Jan 25 22:31:53 2010  Yusuke Endoh  <mame@t...>
 
 	* test/ruby/envutil.rb: use method_defined? instead of
Index: thread.c
===================================================================
--- thread.c	(revision 26408)
+++ thread.c	(revision 26409)
@@ -2457,7 +2457,7 @@
 	wait_100ms.tv_usec = 100 * 1000; /* 100 ms */
 
 	do {
-	    wait = (timeout == 0 || cmp_tv(&wait_100ms, timeout) > 0) ? &wait_100ms : timeout;
+	    wait = (timeout == 0 || cmp_tv(&wait_100ms, timeout) < 0) ? &wait_100ms : timeout;
 	    BLOCKING_REGION({
 		do {
 		    result = select(n, read, write, except, wait);
@@ -2467,16 +2467,16 @@
 		    if (read) *read = orig_read;
 		    if (write) *write = orig_write;
 		    if (except) *except = orig_except;
-		    wait = &wait_100ms;
 		    if (timeout) {
 			struct timeval elapsed;
 			gettimeofday(&elapsed, NULL);
 			subtract_tv(&elapsed, &start_time);
+			gettimeofday(&start_time, NULL);
 			if (!subtract_tv(timeout, &elapsed)) {
 			    finish = 1;
 			    break;
 			}
-			if (cmp_tv(&wait_100ms, timeout) < 0) wait = timeout;
+			if (cmp_tv(&wait_100ms, timeout) > 0) wait = timeout;
 		    }
 		} while (__th->interrupt_flag == 0);
 	    }, 0, 0);

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

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