Rework rb_ec_scheduler_finalize
to ensure exceptions are printed.
This commit is contained in:
parent
dd2e95fb26
commit
a88fe61a3e
Notes:
git
2020-10-01 12:56:34 +09:00
33
eval.c
33
eval.c
@ -146,9 +146,28 @@ ruby_options(int argc, char **argv)
|
|||||||
return iseq;
|
return iseq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
rb_ec_scheduler_finalize(rb_execution_context_t *ec)
|
||||||
|
{
|
||||||
|
rb_thread_t *thread = rb_ec_thread_ptr(ec);
|
||||||
|
enum ruby_tag_type state;
|
||||||
|
|
||||||
|
EC_PUSH_TAG(ec);
|
||||||
|
if ((state = EC_EXEC_TAG()) == TAG_NONE) {
|
||||||
|
rb_thread_scheduler_set(thread->self, Qnil);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
state = error_handle(ec, state);
|
||||||
|
}
|
||||||
|
EC_POP_TAG();
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rb_ec_teardown(rb_execution_context_t *ec)
|
rb_ec_teardown(rb_execution_context_t *ec)
|
||||||
{
|
{
|
||||||
|
// If the user code defined a scheduler for the top level thread, run it:
|
||||||
|
rb_ec_scheduler_finalize(ec);
|
||||||
|
|
||||||
EC_PUSH_TAG(ec);
|
EC_PUSH_TAG(ec);
|
||||||
if (EC_EXEC_TAG() == TAG_NONE) {
|
if (EC_EXEC_TAG() == TAG_NONE) {
|
||||||
rb_vm_trap_exit(rb_ec_vm_ptr(ec));
|
rb_vm_trap_exit(rb_ec_vm_ptr(ec));
|
||||||
@ -158,17 +177,6 @@ rb_ec_teardown(rb_execution_context_t *ec)
|
|||||||
rb_ec_clear_all_trace_func(ec);
|
rb_ec_clear_all_trace_func(ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
rb_ec_scheduler_finalize(rb_execution_context_t *ec)
|
|
||||||
{
|
|
||||||
rb_thread_t *thread = rb_ec_thread_ptr(ec);
|
|
||||||
EC_PUSH_TAG(ec);
|
|
||||||
if (EC_EXEC_TAG() == TAG_NONE) {
|
|
||||||
rb_thread_scheduler_set(thread->self, Qnil);
|
|
||||||
}
|
|
||||||
EC_POP_TAG();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rb_ec_finalize(rb_execution_context_t *ec)
|
rb_ec_finalize(rb_execution_context_t *ec)
|
||||||
{
|
{
|
||||||
@ -222,9 +230,6 @@ rb_ec_cleanup(rb_execution_context_t *ec, volatile int ex)
|
|||||||
rb_threadptr_interrupt(th);
|
rb_threadptr_interrupt(th);
|
||||||
rb_threadptr_check_signal(th);
|
rb_threadptr_check_signal(th);
|
||||||
|
|
||||||
// If the user code defined a scheduler for the top level thread, run it:
|
|
||||||
rb_ec_scheduler_finalize(ec);
|
|
||||||
|
|
||||||
EC_PUSH_TAG(ec);
|
EC_PUSH_TAG(ec);
|
||||||
if ((state = EC_EXEC_TAG()) == TAG_NONE) {
|
if ((state = EC_EXEC_TAG()) == TAG_NONE) {
|
||||||
th = th0;
|
th = th0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user