summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-20 15:57:39 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-20 15:57:39 +0000
commit070cbd942e6f6013ad4b9908f1dffe8dc156f5d0 (patch)
tree1b0f34b13d6cef1722da6f1b7bcd83445bf4715e
parent9cf0cf92f2fa1a660585ead88c9057cfa8697cf7 (diff)
* added monitor.rb test. see #2240 the bug on ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/monitor/test_monitor.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/monitor/test_monitor.rb b/test/monitor/test_monitor.rb
index 064471eecb..973b3c2744 100644
--- a/test/monitor/test_monitor.rb
+++ b/test/monitor/test_monitor.rb
@@ -54,6 +54,32 @@ class TestMonitor < Test::Unit::TestCase
assert_equal((1..10).to_a, ary)
end
+ def test_killed_thread_in_synchronize
+ ary = []
+ queue = Queue.new
+ t1 = Thread.start {
+ queue.pop
+ @monitor.synchronize {
+ ary << :t1
+ }
+ }
+ t2 = Thread.start {
+ queue.pop
+ @monitor.synchronize {
+ ary << :t2
+ }
+ }
+ @monitor.synchronize do
+ queue.enq(nil)
+ queue.enq(nil)
+ assert_equal([], ary)
+ t1.kill
+ t2.kill
+ ary << :main
+ end
+ assert_equal([:main], ary)
+ end
+
def test_try_enter
queue1 = Queue.new
queue2 = Queue.new
@@ -97,6 +123,7 @@ class TestMonitor < Test::Unit::TestCase
end
def _test_timedwait
+ cond = @monitor.new_cond
b = "foo"
queue2 = Queue.new
Thread.start do