From c030326a09e5b46f5d0223fb8506723a055953e3 Mon Sep 17 00:00:00 2001 From: mame Date: Sun, 11 May 2008 10:06:58 +0000 Subject: * test/ruby/test_thread.rb: kill and join temporal threads that are created in each test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_thread.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index bdb9ec24f5..9abe39b104 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -8,13 +8,29 @@ class TestThread < Test::Unit::TestCase end class Thread < ::Thread + Threads = [] def self.new(*) th = super th.abort_on_exception = true + Threads << th th end end + def setup + Thread::Threads.clear + end + + def teardown + Thread::Threads.each do |t| + t.kill if t.alive? + begin + t.join + rescue Exception + end + end + end + def test_mutex_synchronize m = Mutex.new r = 0 -- cgit v1.2.3