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
@ -648,14 +648,14 @@ class TestThread < Test::Unit::TestCase
|
|||||||
|
|
||||||
def make_handle_interrupt_test_thread1 flag
|
def make_handle_interrupt_test_thread1 flag
|
||||||
r = []
|
r = []
|
||||||
ready_p = false
|
ready_q = Queue.new
|
||||||
done = false
|
done_q = Queue.new
|
||||||
th = Thread.new{
|
th = Thread.new{
|
||||||
begin
|
begin
|
||||||
Thread.handle_interrupt(RuntimeError => flag){
|
Thread.handle_interrupt(RuntimeError => flag){
|
||||||
begin
|
begin
|
||||||
ready_p = true
|
ready_q << true
|
||||||
sleep 0.01 until done
|
done_q.pop
|
||||||
rescue
|
rescue
|
||||||
r << :c1
|
r << :c1
|
||||||
end
|
end
|
||||||
@ -664,10 +664,10 @@ class TestThread < Test::Unit::TestCase
|
|||||||
r << :c2
|
r << :c2
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
Thread.pass until ready_p
|
ready_q.pop
|
||||||
th.raise
|
th.raise
|
||||||
begin
|
begin
|
||||||
done = true
|
done_q << true
|
||||||
th.join
|
th.join
|
||||||
rescue
|
rescue
|
||||||
r << :c3
|
r << :c3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user