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

ruby-changes:26396

From: kosaki <ko1@a...>
Date: Tue, 18 Dec 2012 19:07:15 +0900 (JST)
Subject: [ruby-changes:26396] kosaki:r38447 (trunk): * thread.c (rb_thread_wait_fd_rw): fix infinite loop bug.

kosaki	2012-12-18 19:07:05 +0900 (Tue, 18 Dec 2012)

  New Revision: 38447

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

  Log:
    * thread.c (rb_thread_wait_fd_rw): fix infinite loop bug.
      rb_wait_for_single_fd() never return positive number.

  Modified files:
    trunk/ChangeLog
    trunk/thread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38446)
+++ ChangeLog	(revision 38447)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Dec 18 18:55:33 2012  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* thread.c (rb_thread_wait_fd_rw): fix infinite loop bug.
+	  rb_wait_for_single_fd() never return positive number.
+
 Tue Dec 18 17:24:40 2012  Eric Hodel  <drbrain@s...>
 
 	* lib/rdoc/encoding.rb:  Do not remove #! line from document when
Index: thread.c
===================================================================
--- thread.c	(revision 38446)
+++ thread.c	(revision 38447)
@@ -3320,12 +3320,10 @@ rb_thread_wait_fd_rw(int fd, int read) https://github.com/ruby/ruby/blob/trunk/thread.c#L3320
     if (fd < 0) {
 	rb_raise(rb_eIOError, "closed stream");
     }
-    while (result <= 0) {
-	result = rb_wait_for_single_fd(fd, events, NULL);
 
-	if (result < 0) {
-	    rb_sys_fail(0);
-	}
+    result = rb_wait_for_single_fd(fd, events, NULL);
+    if (result < 0) {
+	rb_sys_fail(0);
     }
 
     thread_debug("rb_thread_wait_fd_rw(%d, %s): done\n", fd, read ? "read" : "write");

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

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