aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eval.c4
-rw-r--r--thread.c14
-rw-r--r--vm_core.h1
3 files changed, 9 insertions, 10 deletions
diff --git a/eval.c b/eval.c
index 46c7c1872d..582a605f9b 100644
--- a/eval.c
+++ b/eval.c
@@ -583,10 +583,10 @@ setup_exception(rb_execution_context_t *ec, int tag, volatile VALUE mesg, VALUE
/*! \private */
void
-rb_threadptr_setup_exception(rb_thread_t *th, VALUE mesg, VALUE cause)
+rb_ec_setup_exception(const rb_execution_context_t *ec, VALUE mesg, VALUE cause)
{
if (cause == Qundef) {
- cause = get_ec_errinfo(th->ec);
+ cause = get_ec_errinfo(ec);
}
if (cause != mesg) {
rb_ivar_set(mesg, id_cause, cause);
diff --git a/thread.c b/thread.c
index 642d48f81c..3cbb97dd37 100644
--- a/thread.c
+++ b/thread.c
@@ -2112,14 +2112,12 @@ rb_threadptr_ready(rb_thread_t *th)
rb_threadptr_interrupt(th);
}
-void rb_threadptr_setup_exception(rb_thread_t *th, VALUE mesg, VALUE cause);
-
static VALUE
-rb_threadptr_raise(rb_thread_t *th, int argc, VALUE *argv)
+rb_threadptr_raise(rb_thread_t *target_th, int argc, VALUE *argv)
{
VALUE exc;
- if (rb_threadptr_dead(th)) {
+ if (rb_threadptr_dead(target_th)) {
return Qnil;
}
@@ -2132,13 +2130,13 @@ rb_threadptr_raise(rb_thread_t *th, int argc, VALUE *argv)
/* making an exception object can switch thread,
so we need to check thread deadness again */
- if (rb_threadptr_dead(th)) {
+ if (rb_threadptr_dead(target_th)) {
return Qnil;
}
- rb_threadptr_setup_exception(GET_THREAD(), exc, Qundef);
- rb_threadptr_pending_interrupt_enque(th, exc);
- rb_threadptr_interrupt(th);
+ rb_ec_setup_exception(GET_EC(), exc, Qundef);
+ rb_threadptr_pending_interrupt_enque(target_th, exc);
+ rb_threadptr_interrupt(target_th);
return Qnil;
}
diff --git a/vm_core.h b/vm_core.h
index 202cb24137..2136970a66 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -1498,6 +1498,7 @@ VALUE rb_iseq_pathobj_new(VALUE path, VALUE realpath);
void rb_iseq_pathobj_set(const rb_iseq_t *iseq, VALUE path, VALUE realpath);
int rb_ec_frame_method_id_and_class(const rb_execution_context_t *ec, ID *idp, ID *called_idp, VALUE *klassp);
+void rb_ec_setup_exception(const rb_execution_context_t *ec, VALUE mesg, VALUE cause);
VALUE rb_vm_invoke_proc(rb_execution_context_t *ec, rb_proc_t *proc, int argc, const VALUE *argv, VALUE block_handler);
VALUE rb_vm_make_proc_lambda(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass, int8_t is_lambda);