ruby-changes:26153
From: tarui <ko1@a...>
Date: Wed, 5 Dec 2012 18:55:10 +0900 (JST)
Subject: [ruby-changes:26153] tarui:r38210 (trunk): * thread.c (rb_thread_s_async_interrupt_timing): have to check ints before jumpping out.
tarui 2012-12-05 18:54:58 +0900 (Wed, 05 Dec 2012) New Revision: 38210 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38210 Log: * 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. Modified files: trunk/ChangeLog trunk/test/ruby/test_thread.rb trunk/thread.c Index: ChangeLog =================================================================== --- ChangeLog (revision 38209) +++ ChangeLog (revision 38210) @@ -1,3 +1,12 @@ +Wed Dec 5 18:53:00 2012 Masaya Tarui <tarui@r...> + + * 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. + Wed Dec 5 16:54:28 2012 Koichi Sasada <ko1@a...> * test/ruby/memory_status.rb: suppress warning. Index: thread.c =================================================================== --- thread.c (revision 38209) +++ thread.c (revision 38210) @@ -1686,12 +1686,12 @@ RUBY_VM_SET_INTERRUPT(th); } + RUBY_VM_CHECK_INTS(th); + if (state) { JUMP_TAG(state); } - RUBY_VM_CHECK_INTS(th); - return r; } Index: test/ruby/test_thread.rb =================================================================== --- test/ruby/test_thread.rb (revision 38209) +++ test/ruby/test_thread.rb (revision 38210) @@ -563,6 +563,34 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/