thread may leak if assert fails before join is finished

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2015-10-28 18:58:34 +00:00
Родитель 1dcd94df24
Коммит 875b7d9e66
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -637,7 +637,7 @@ class TestThread < Test::Unit::TestCase
th = Thread.start{
Thread.handle_interrupt(Object => :on_blocking){
begin
sleep 0.0001 until r == :wait
Thread.pass until r == :wait
Thread.current.raise RuntimeError
r = :ok
sleep
@ -647,8 +647,9 @@ class TestThread < Test::Unit::TestCase
}
}
assert_raise(e) {r = :wait; sleep 1}
ensure
assert_raise(RuntimeError) {th.join(0)}
ensure
th.kill
end
assert_equal(:ok,r)
end