summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-22 17:44:28 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-22 17:44:28 +0000
commit07ac36ada5a486023593d129b54be836923cfa4d (patch)
treee024087285333ecd9d1d5638be5b48e0c5317a79 /thread.c
parentb3cbe251735465520907cd07b3868e8128182ff7 (diff)
merge revision(s) r45899: [Backport #9751]
* thread.c (thread_start_func_2): stop if forked in a sub-thread, the thread has become the main thread. [ruby-core:62070] [Bug #9751] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index b1dcc5bbde..f3e60fce41 100644
--- a/thread.c
+++ b/thread.c
@@ -569,6 +569,9 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
thread_debug("thread end: %p\n", (void *)th);
main_th = th->vm->main_thread;
+ if (main_th == th) {
+ ruby_stop(0);
+ }
if (RB_TYPE_P(errinfo, T_OBJECT)) {
/* treat with normal error object */
rb_threadptr_raise(main_th, 1, &errinfo);