* cont.c (rb_fiber_start): in case of jump with TAG_FATAL,
enqueue error into async_errinfo_queue, because you cannot call TH_TAG_JUMP() in this function. [ruby-dev:45218] [Bug #5993] * thread.c (rb_threadptr_execute_interrupts): now INT2FIX(TAG_FATAL) can be popped from async_errinfo_queue. * vm.c (rb_vm_make_jump_tag_but_local_jump): revert r38441. rb_vm_make_jump_tag_but_local_jump() shouldn't return exception in case of state == TAG_FATAL. * test/ruby/test_fiber.rb (test_exit_in_fiber): fix a test to illuminate Thread.exit should terminate current Thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a44e41e831
commit
6a35c26b2d
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
|||||||
|
Wed Dec 19 02:34:48 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
|
||||||
|
|
||||||
|
* cont.c (rb_fiber_start): in case of jump with TAG_FATAL,
|
||||||
|
enqueue error into async_errinfo_queue, because you cannot call
|
||||||
|
TH_TAG_JUMP() in this function. [ruby-dev:45218] [Bug #5993]
|
||||||
|
|
||||||
|
* thread.c (rb_threadptr_execute_interrupts): now INT2FIX(TAG_FATAL)
|
||||||
|
can be popped from async_errinfo_queue.
|
||||||
|
|
||||||
|
* vm.c (rb_vm_make_jump_tag_but_local_jump): revert r38441.
|
||||||
|
rb_vm_make_jump_tag_but_local_jump() shouldn't return exception
|
||||||
|
in case of state == TAG_FATAL.
|
||||||
|
|
||||||
|
* test/ruby/test_fiber.rb (test_exit_in_fiber): fix a test to illuminate
|
||||||
|
Thread.exit should terminate current Thread.
|
||||||
|
|
||||||
Sat Dec 22 13:15:08 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
|
Sat Dec 22 13:15:08 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
|
||||||
|
|
||||||
* gc.c (obj_id_to_ref): add a macro to treat Bignum object id.
|
* gc.c (obj_id_to_ref): add a macro to treat Bignum object id.
|
||||||
|
3
cont.c
3
cont.c
@ -1164,6 +1164,9 @@ rb_fiber_start(void)
|
|||||||
if (state == TAG_RAISE) {
|
if (state == TAG_RAISE) {
|
||||||
rb_threadptr_async_errinfo_enque(th, th->errinfo);
|
rb_threadptr_async_errinfo_enque(th, th->errinfo);
|
||||||
}
|
}
|
||||||
|
else if (state == TAG_FATAL) {
|
||||||
|
rb_threadptr_async_errinfo_enque(th, th->errinfo);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
VALUE err = rb_vm_make_jump_tag_but_local_jump(state, th->errinfo);
|
VALUE err = rb_vm_make_jump_tag_but_local_jump(state, th->errinfo);
|
||||||
if (!NIL_P(err))
|
if (!NIL_P(err))
|
||||||
|
@ -267,7 +267,7 @@ if false
|
|||||||
def test_exit_in_fiber
|
def test_exit_in_fiber
|
||||||
bug5993 = '[ruby-dev:45218]'
|
bug5993 = '[ruby-dev:45218]'
|
||||||
assert_nothing_raised(bug5993) do
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
3
thread.c
3
thread.c
@ -1835,7 +1835,8 @@ rb_threadptr_execute_interrupts(rb_thread_t *th, int blocking_timing)
|
|||||||
/* no error */
|
/* no error */
|
||||||
}
|
}
|
||||||
else if (err == eKillSignal /* Thread#kill receieved */ ||
|
else if (err == eKillSignal /* Thread#kill receieved */ ||
|
||||||
err == eTerminateSignal /* Terminate thread */ ) {
|
err == eTerminateSignal /* Terminate thread */ ||
|
||||||
|
err == INT2FIX(TAG_FATAL) /* Thread.exit etc. */ ) {
|
||||||
rb_threadptr_to_kill(th);
|
rb_threadptr_to_kill(th);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
5
vm.c
5
vm.c
@ -917,11 +917,6 @@ rb_vm_make_jump_tag_but_local_jump(int state, VALUE val)
|
|||||||
case TAG_RETRY:
|
case TAG_RETRY:
|
||||||
result = make_localjump_error("retry outside of rescue clause", Qnil, state);
|
result = make_localjump_error("retry outside of rescue clause", Qnil, state);
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user