mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
8934082ec4
commit
8b31febd15
1 changed files with 6 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue