mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
65d1a419d9
commit
c030326a09
2 changed files with 21 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun May 11 19:04:06 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* test/ruby/test_thread.rb: kill and join temporal threads that are
|
||||
created in each test.
|
||||
|
||||
Sun May 11 17:58:45 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/ruby/test_process.rb (TestProcess#with_stdin): defined.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue