From 646c53895f80358d153d04f04b726d0d14388cf2 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 9 Sep 2016 08:59:48 +0000 Subject: thread.c: set cause by Thread#raise * thread.c (rb_threadptr_raise): set cause from the called thread, but not from the thread to be interrupted. [ruby-core:77222] [Bug #12741] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'eval.c') diff --git a/eval.c b/eval.c index bad3c83714..1baf914a3a 100644 --- a/eval.c +++ b/eval.c @@ -567,6 +567,17 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause) } } +void +rb_threadptr_setup_exception(rb_thread_t *th, VALUE mesg, VALUE cause) +{ + if (cause == Qundef) { + cause = get_thread_errinfo(th); + } + if (cause != mesg) { + rb_ivar_set(mesg, id_cause, cause); + } +} + static void rb_longjmp(int tag, volatile VALUE mesg, VALUE cause) { -- cgit v1.2.3