Bug #5993 » thread_exit_in_fiber.patch
cont.c | ||
---|---|---|
if (state == TAG_RAISE) {
|
||
rb_threadptr_async_errinfo_enque(th, th->errinfo);
|
||
}
|
||
else if (state == TAG_FATAL) {
|
||
rb_threadptr_async_errinfo_enque(th, th->errinfo);
|
||
}
|
||
else {
|
||
VALUE err = rb_vm_make_jump_tag_but_local_jump(state, th->errinfo);
|
||
if (!NIL_P(err))
|
test/ruby/test_fiber.rb | ||
---|---|---|
def test_exit_in_fiber
|
||
bug5993 = '[ruby-dev:45218]'
|
||
assert_nothing_raised(bug5993) do
|
||
Thread.new{ Fiber.new{ Thread.exit }.resume }.join
|
||
Thread.new{ Fiber.new{ Thread.exit }.resume; raise "unreachable" }.join
|
||
end
|
||
end
|
||
thread.c | ||
---|---|---|
if (err == Qundef) {
|
||
/* no error */
|
||
}
|
||
else if (err == eKillSignal /* Thread#kill receieved */ ||
|
||
err == eTerminateSignal /* Terminate thread */ ) {
|
||
else if (err == eKillSignal /* Thread#kill receieved */ ||
|
||
err == eTerminateSignal /* Terminate thread */ ||
|
||
err == INT2FIX(TAG_FATAL) /* Thread.exit etc. */ ) {
|
||
rb_threadptr_to_kill(th);
|
||
}
|
||
else {
|
vm.c | ||
---|---|---|
case TAG_RETRY:
|
||
result = make_localjump_error("retry outside of rescue clause", Qnil, state);
|
||
break;
|
||
case TAG_FATAL:
|
||
/* internal exception or Thread.exit */
|
||
/* Thread.exit set th->errinfo to INT2FIX(TAG_FATAL) */
|
||
if (!FIXNUM_P(val))
|
||
result = val;
|
||
default:
|
||
break;
|
||
}
|