From 17a11774ca9bc79609128187e3b6c814bd590ce5 Mon Sep 17 00:00:00 2001 From: tarui Date: Wed, 5 Dec 2012 09:54:58 +0000 Subject: * thread.c (rb_thread_s_async_interrupt_timing): have to check ints before jumpping out. * test/ruby/test_thread.rb (test_async_interrupt_with_return): add test rescue has to catch a queued async exception at the time of return. * test/ruby/test_thread.rb (test_async_interrupt_with_break): add test rescue has to catch a queued async exception at the time of break. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_thread.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index bff34b3b25..454229ae85 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -563,6 +563,34 @@ class TestThread < Test::Unit::TestCase Thread.async_interrupt_timing([]) {} # array } end + + def for_test_async_interrupt_with_return + Thread.async_interrupt_timing(Object => :defer){ + Thread.current.raise RuntimeError.new("have to be rescured") + return + } + rescue + end + + def test_async_interrupt_with_return + assert_nothing_raised do + for_test_async_interrupt_with_return + dummy_for_check_ints=nil + end + end + + def test_async_interrupt_with_break + assert_nothing_raised do + begin + Thread.async_interrupt_timing(Object => :defer){ + Thread.current.raise RuntimeError.new("have to be rescured") + break + } + rescue + end + dummy_for_check_ints=nil + end + end def test_async_interrupt_blocking r=:ng -- cgit v1.2.3