diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-20 22:52:57 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-20 22:52:57 +0000 |
commit | 8b31febd1536d821ef2c0e41cba21204ceb0fa80 (patch) | |
tree | c99b929ded556ce25dba2dc93bda38c9c3e7a8ba /test | |
parent | 8934082ec4cf45df46409f093c93266ca001dd4e (diff) | |
download | ruby-8b31febd1536d821ef2c0e41cba21204ceb0fa80.tar.gz |
use correct synchronization.
* test/ruby/test_thread.rb (make_handle_interrupt_test_thread1): use Queue
to use correct synchronization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_thread.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index e9bf1f16b6..a4d70c4607 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -648,14 +648,14 @@ class TestThread < Test::Unit::TestCase 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 r << :c2 end } - Thread.pass until ready_p + ready_q.pop th.raise begin - done = true + done_q << true th.join rescue r << :c3 |