ruby-changes:13634
From: nahi <ko1@a...>
Date: Wed, 21 Oct 2009 00:57:49 +0900 (JST)
Subject: [ruby-changes:13634] Ruby:r25418 (trunk): * added monitor.rb test. see #2240 the bug on ruby_1_8.
nahi 2009-10-21 00:57:39 +0900 (Wed, 21 Oct 2009) New Revision: 25418 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25418 Log: * added monitor.rb test. see #2240 the bug on ruby_1_8. Modified files: trunk/test/monitor/test_monitor.rb Index: test/monitor/test_monitor.rb =================================================================== --- test/monitor/test_monitor.rb (revision 25417) +++ test/monitor/test_monitor.rb (revision 25418) @@ -54,6 +54,32 @@ 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 @@ end def _test_timedwait + cond = @monitor.new_cond b = "foo" queue2 = Queue.new Thread.start do -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/