* 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
This commit is contained in:
parent
592e87e1f8
commit
17a11774ca
@ -1,3 +1,12 @@
|
|||||||
|
Wed Dec 5 18:53:00 2012 Masaya Tarui <tarui@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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@atdot.net>
|
Wed Dec 5 16:54:28 2012 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* test/ruby/memory_status.rb: suppress warning.
|
* test/ruby/memory_status.rb: suppress warning.
|
||||||
|
@ -563,6 +563,34 @@ class TestThread < Test::Unit::TestCase
|
|||||||
Thread.async_interrupt_timing([]) {} # array
|
Thread.async_interrupt_timing([]) {} # array
|
||||||
}
|
}
|
||||||
end
|
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
|
def test_async_interrupt_blocking
|
||||||
r=:ng
|
r=:ng
|
||||||
|
4
thread.c
4
thread.c
@ -1686,12 +1686,12 @@ rb_thread_s_async_interrupt_timing(VALUE self, VALUE mask_arg)
|
|||||||
RUBY_VM_SET_INTERRUPT(th);
|
RUBY_VM_SET_INTERRUPT(th);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RUBY_VM_CHECK_INTS(th);
|
||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
JUMP_TAG(state);
|
JUMP_TAG(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
RUBY_VM_CHECK_INTS(th);
|
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user