* test/ruby/test_thread.rb (test_cv_wait_deadlock): enable

cv deadlock test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kosaki 2012-12-01 08:28:56 +00:00
Родитель 1f1db611b9
Коммит afbbcd133c
2 изменённых файлов: 23 добавлений и 12 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Sat Dec 1 15:14:25 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* test/ruby/test_thread.rb (test_cv_wait_deadlock): enable
cv deadlock test.
Sat Dec 1 14:23:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com> Sat Dec 1 14:23:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* lib/thread.rb (ConditionVariable): use hash instead of array for * lib/thread.rb (ConditionVariable): use hash instead of array for

Просмотреть файл

@ -197,18 +197,24 @@ class TestThread < Test::Unit::TestCase
assert_equal ["C1", "C1", "C1", "P1", "P2", "C2", "C2", "C2"], result assert_equal ["C1", "C1", "C1", "P1", "P2", "C2", "C2", "C2"], result
end end
# Hmm.. don't we have a way of catch fatal exception? def test_condvar_wait_deadlock
# assert_in_out_err([], <<-INPUT, ["No live threads left. Deadlock?"], [])
# def test_cv_wait_deadlock require "thread"
# mutex = Mutex.new
# cv = ConditionVariable.new mutex = Mutex.new
# cv = ConditionVariable.new
# assert_raise(fatal) {
# mutex.lock mesg = nil
# cv.wait mutex begin
# mutex.unlock mutex.lock
# } cv.wait mutex
# end mutex.unlock
rescue Exception => e
mesg = e.message
end
print mesg
INPUT
end
def test_condvar_wait_deadlock_2 def test_condvar_wait_deadlock_2
nr_threads = 3 nr_threads = 3