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

ruby-changes:23345

From: naruse <ko1@a...>
Date: Thu, 19 Apr 2012 11:50:14 +0900 (JST)
Subject: [ruby-changes:23345] naruse:r35396 (trunk): Fix multithread issue in the test of r35391

naruse	2012-04-19 11:49:48 +0900 (Thu, 19 Apr 2012)

  New Revision: 35396

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

  Log:
    Fix multithread issue in the test of r35391
    
    pipe() uses threads and its reader thread may work before the writer
    writes "foob". On such case, the reader will raise error.

  Modified files:
    trunk/test/ruby/test_io.rb

Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 35395)
+++ test/ruby/test_io.rb	(revision 35396)
@@ -1069,13 +1069,12 @@
 
   def test_read_nonblock_with_not_empty_buffer
     skip "IO#read_nonblock is not supported on file/pipe." if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
-    pipe(proc do |w|
+    with_pipe {|r, w|
       w.write "foob"
       w.close
-    end, proc do |r|
       r.read_nonblock(5, s = "01234567")
       assert_equal("foob", s)
-    end)
+    }
   end
 
   def test_read_nonblock_error

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

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