diff options
| author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-11 10:06:58 +0000 |
|---|---|---|
| committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-11 10:06:58 +0000 |
| commit | 2188bcf815dab243b7d317a085267c278f2d64c2 (patch) | |
| tree | 56396e3914110915bcd4899fae4de2b7bf78e4b2 /test/ruby/test_thread.rb | |
| parent | 6eb91bebfeae4c9d1d21e86f2028f2f97c41e165 (diff) | |
| download | ruby-2188bcf815dab243b7d317a085267c278f2d64c2.tar.gz ruby-2188bcf815dab243b7d317a085267c278f2d64c2.tar.xz ruby-2188bcf815dab243b7d317a085267c278f2d64c2.zip | |
* test/ruby/test_thread.rb: kill and join temporal threads that are
created in each test.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_thread.rb')
| -rw-r--r-- | test/ruby/test_thread.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index bdb9ec24f..9abe39b10 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 |
