summaryrefslogtreecommitdiff
path: root/test/monitor/test_monitor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/monitor/test_monitor.rb')
-rw-r--r--test/monitor/test_monitor.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/monitor/test_monitor.rb b/test/monitor/test_monitor.rb
index a036069647..8854b59ccc 100644
--- a/test/monitor/test_monitor.rb
+++ b/test/monitor/test_monitor.rb
@@ -269,4 +269,26 @@ class TestMonitor < Test::Unit::TestCase
# end
# cumber_thread.kill
end
+
+ def test_wait_interruption
+ queue = Queue.new
+ cond = @monitor.new_cond
+ @monitor.define_singleton_method(:mon_enter_for_cond) do |*args|
+ queue.deq
+ super(*args)
+ end
+ th = Thread.start {
+ @monitor.synchronize do
+ begin
+ cond.wait(0.1)
+ rescue Interrupt
+ @monitor.instance_variable_get(:@mon_owner)
+ end
+ end
+ }
+ sleep(0.1)
+ th.raise(Interrupt)
+ queue.enq(nil)
+ assert_equal th, th.value
+ end
end