diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-26 05:13:40 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-26 05:13:40 +0000 |
commit | 72dce44d7b353b0e24324e235ca71d249de18515 (patch) | |
tree | fa57d9dc003cea65e123ddfd4ea69b426e1c0a69 /test/ruby/test_threadgroup.rb | |
parent | 501afa013498079ba8d2bd047e86430fe17d2325 (diff) | |
download | ruby-72dce44d7b353b0e24324e235ca71d249de18515.tar.gz |
test/ruby: fix leaked threads
* test/thread/test_{backtrace,beginendblock,proc,threadgroup}.rb:
join work threads not to leak threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_threadgroup.rb')
-rw-r--r-- | test/ruby/test_threadgroup.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/ruby/test_threadgroup.rb b/test/ruby/test_threadgroup.rb index e29c477247..f4c03de67e 100644 --- a/test/ruby/test_threadgroup.rb +++ b/test/ruby/test_threadgroup.rb @@ -5,10 +5,13 @@ require_relative 'envutil' class TestThreadGroup < Test::Unit::TestCase def test_thread_init thgrp = ThreadGroup.new - Thread.new{ + th = Thread.new{ thgrp.add(Thread.current) - assert_equal(thgrp, Thread.new{sleep 1}.group) - }.join + Thread.new{sleep 1} + }.value + assert_equal(thgrp, th.group) + ensure + th.join end def test_frozen_thgroup |