From 9883632d6ad6dec664047df38f8098ef46963bb0 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 10 May 2014 04:32:22 +0000 Subject: thread.c: stop if forked in a sub-thread * 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/trunk@45899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'thread.c') diff --git a/thread.c b/thread.c index dfa91a827b..61cf3a1a03 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); -- cgit v1.2.3