summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-12 12:55:00 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-12 12:55:00 +0000
commit91036252bb18b6773a8c8e4190623d659261e4a5 (patch)
tree78e3eb511963e6d7fa230f7937dd7e6346ba3ef0 /thread.c
parent8a4f4f204d9946fb6154409a43527eb53b672b51 (diff)
merge revision(s) 57595: [Backport #8996]
check thread deadness correctly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index 9be300a26c..ee75ec39ee 100644
--- a/thread.c
+++ b/thread.c
@@ -2103,6 +2103,13 @@ rb_threadptr_raise(rb_thread_t *th, int argc, VALUE *argv)
else {
exc = rb_make_exception(argc, argv);
}
+
+ /* making an exception object can switch thread,
+ so we need to check thread deadness again */
+ if (rb_threadptr_dead(th)) {
+ return Qnil;
+ }
+
rb_threadptr_setup_exception(GET_THREAD(), exc, Qundef);
rb_threadptr_pending_interrupt_enque(th, exc);
rb_threadptr_interrupt(th);