Bug #13688 » thread-hang-13688.patch
spec/ruby/core/thread/raise_spec.rb | ||
---|---|---|
end
|
||
it "can go unhandled" do
|
||
th_started = false
|
||
t = Thread.new do
|
||
Thread.current.report_on_exception = false
|
||
th_started = true
|
||
loop { Thread.pass }
|
||
end
|
||
nil until th_started
|
||
t.raise
|
||
-> { t.value }.should raise_error(RuntimeError)
|
||
end
|
test/ruby/test_thread.rb | ||
---|---|---|
def test_handle_interrupt_and_io
|
||
assert_in_out_err([], <<-INPUT, %w(ok), [])
|
||
th_waiting = true
|
||
th_started = false
|
||
t = Thread.new {
|
||
Thread.current.report_on_exception = false
|
||
Thread.handle_interrupt(RuntimeError => :on_blocking) {
|
||
th_started = true
|
||
nil while th_waiting
|
||
# async interrupt should be raised _before_ writing puts arguments
|
||
puts "ng"
|
||
... | ... | |
}
|
||
Thread.pass while t.stop?
|
||
nil until th_started
|
||
t.raise RuntimeError
|
||
th_waiting = false
|
||
t.join rescue nil
|
thread.c | ||
---|---|---|
args_ptr = RARRAY_CONST_PTR(args);
|
||
}
|
||
vm_check_ints_blocking(th->ec);
|
||
th->value = rb_vm_invoke_proc(th->ec, proc,
|
||
(int)args_len, args_ptr,
|
||
VM_BLOCK_HANDLER_NONE);
|
- « Previous
- 1
- 2
- Next »