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

ruby-changes:15599

From: akr <ko1@a...>
Date: Tue, 27 Apr 2010 06:21:25 +0900 (JST)
Subject: [ruby-changes:15599] Ruby:r27506 (trunk): * io.c (select_internal): IO which cbuf is not empty is readable.

akr	2010-04-27 06:21:07 +0900 (Tue, 27 Apr 2010)

  New Revision: 27506

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

  Log:
    * io.c (select_internal): IO which cbuf is not empty is readable.

  Modified files:
    trunk/ChangeLog
    trunk/io.c
    trunk/test/ruby/test_io_m17n.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27505)
+++ ChangeLog	(revision 27506)
@@ -1,3 +1,7 @@
+Tue Apr 27 06:20:13 2010  Tanaka Akira  <akr@f...>
+
+	* io.c (select_internal): IO which cbuf is not empty is readable.
+
 Tue Apr 27 00:07:32 2010  Yusuke Endoh  <mame@t...>
 
 	* parse.y (program): check void_expr when rb_parse_in_main().
Index: io.c
===================================================================
--- io.c	(revision 27505)
+++ io.c	(revision 27506)
@@ -7153,7 +7153,7 @@
 	for (i=0; i<RARRAY_LEN(read); i++) {
 	    GetOpenFile(rb_io_get_io(RARRAY_PTR(read)[i]), fptr);
 	    rb_fd_set(fptr->fd, &fds[0]);
-	    if (READ_DATA_PENDING(fptr)) { /* check for buffered data */
+	    if (READ_DATA_PENDING(fptr) || READ_CHAR_PENDING(fptr)) { /* check for buffered data */
 		pending++;
 		rb_fd_set(fptr->fd, &fds[3]);
 	    }
Index: test/ruby/test_io_m17n.rb
===================================================================
--- test/ruby/test_io_m17n.rb	(revision 27505)
+++ test/ruby/test_io_m17n.rb	(revision 27506)
@@ -1774,5 +1774,15 @@
     }
   end
 
+
+  def test_cbuf_select
+    with_tmpdir {
+      r, w = IO.pipe
+      w << "\r\n"
+      r.set_encoding("US-ASCII:UTF-8", :universal_newline => true)
+      r.ungetc(r.getc)
+      assert_equal([[r],[],[]], IO.select([r], nil, nil, 1))
+    }
+  end
 end
 

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

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