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

ruby-changes:24879

From: kosaki <ko1@a...>
Date: Sun, 9 Sep 2012 16:20:13 +0900 (JST)
Subject: [ruby-changes:24879] kosaki:r36931 (trunk): * io.c (io_bufread): removed unnecessary rb_thread_wait_fd().

kosaki	2012-09-09 16:20:00 +0900 (Sun, 09 Sep 2012)

  New Revision: 36931

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

  Log:
    * io.c (io_bufread): removed unnecessary rb_thread_wait_fd().
      Patch by Eric Wong. [Bug #6629] [ruby-core:45789]
    * io.c (rb_io_sysread): ditto.
    * io.c (copy_stream_fallback_body): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36930)
+++ ChangeLog	(revision 36931)
@@ -1,3 +1,10 @@
+Sun Sep  9 16:08:48 2012  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* io.c (io_bufread): removed unnecessary rb_thread_wait_fd().
+	  Patch by Eric Wong. [Bug #6629] [ruby-core:45789]
+	* io.c (rb_io_sysread): ditto.
+	* io.c (copy_stream_fallback_body): ditto.
+
 Sun Sep  9 15:21:52 2012  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* thread.c (rb_mutex_lock): stop multiple threads use
Index: io.c
===================================================================
--- io.c	(revision 36930)
+++ io.c	(revision 36931)
@@ -1912,7 +1912,6 @@
 	    }
 	    offset += c;
 	    if ((n -= c) <= 0) break;
-	    rb_thread_wait_fd(fptr->fd);
 	}
 	return len - n;
     }
@@ -1923,7 +1922,6 @@
 	    offset += c;
 	    if ((n -= c) <= 0) break;
 	}
-	rb_thread_wait_fd(fptr->fd);
 	rb_io_check_closed(fptr);
 	if (io_fillbuf(fptr) < 0) {
 	    break;
@@ -4338,7 +4336,16 @@
     }
 
     n = fptr->fd;
+
+    /*
+     * FIXME: removing rb_thread_wait_fd() here changes sysread semantics
+     * on non-blocking IOs.  However, it's still currently possible
+     * for sysread to raise Errno::EAGAIN if another thread read()s
+     * the IO after we return from rb_thread_wait_fd() but before
+     * we call read()
+     */
     rb_thread_wait_fd(fptr->fd);
+
     rb_io_check_closed(fptr);
 
     io_setstrbuf(&str, ilen);
@@ -9796,7 +9803,6 @@
         }
         else {
             ssize_t ss;
-            rb_thread_wait_fd(stp->src_fd);
             rb_str_resize(buf, buflen);
             ss = maygvl_copy_stream_read(1, stp, RSTRING_PTR(buf), l, off);
             if (ss == -1)

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

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