ruby-changes:46308
From: ko1 <ko1@a...>
Date: Fri, 21 Apr 2017 07:53:04 +0900 (JST)
Subject: [ruby-changes:46308] ko1:r58422 (trunk): use correct synchronization.
ko1 2017-04-21 07:52:57 +0900 (Fri, 21 Apr 2017) New Revision: 58422 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58422 Log: use correct synchronization. * test/ruby/test_thread.rb (make_handle_interrupt_test_thread1): use Queue to use correct synchronization. Modified files: trunk/test/ruby/test_thread.rb Index: test/ruby/test_thread.rb =================================================================== --- test/ruby/test_thread.rb (revision 58421) +++ test/ruby/test_thread.rb (revision 58422) @@ -648,14 +648,14 @@ class TestThread < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L648 def make_handle_interrupt_test_thread1 flag r = [] - ready_p = false - done = false + ready_q = Queue.new + done_q = Queue.new th = Thread.new{ begin Thread.handle_interrupt(RuntimeError => flag){ begin - ready_p = true - sleep 0.01 until done + ready_q << true + done_q.pop rescue r << :c1 end @@ -664,10 +664,10 @@ class TestThread < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L664 r << :c2 end } - Thread.pass until ready_p + ready_q.pop th.raise begin - done = true + done_q << true th.join rescue r << :c3 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/