1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
parent 1dcd94df24
commit 875b7d9e66

View file

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