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

ruby-changes:46241

From: ko1 <ko1@a...>
Date: Sat, 15 Apr 2017 03:14:30 +0900 (JST)
Subject: [ruby-changes:46241] ko1:r58356 (trunk): more explicit synchronization.

ko1	2017-04-15 03:14:25 +0900 (Sat, 15 Apr 2017)

  New Revision: 58356

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58356

  Log:
    more explicit synchronization.
    
    * test/ruby/test_io.rb (test_race_closed_stream): wait for blocking by r.gets.
      On some systems (for example, high load average systems) can't start Thread
      correctly and can't wait r.gets in invoked Thread.

  Modified files:
    trunk/test/ruby/test_io.rb
Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 58355)
+++ test/ruby/test_io.rb	(revision 58356)
@@ -3400,16 +3400,19 @@ __END__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L3400
   def test_race_closed_stream
     bug13158 = '[ruby-core:79262] [Bug #13158]'
     closed = nil
+    q = Queue.new
     IO.pipe do |r, w|
       thread = Thread.new do
         begin
+          q << true
           while r.gets
           end
         ensure
           closed = r.closed?
         end
       end
-      sleep 0.01
+      q.pop
+      sleep 0.1 # wait for blocking by r.gets
       r.close
       assert_raise_with_message(IOError, /stream closed/) do
         thread.join

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

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