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:
parent
1dcd94df24
commit
875b7d9e66
1 changed files with 3 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue