aboutsummaryrefslogtreecommitdiffstats
path: root/thread.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-14 22:52:01 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-14 22:52:01 +0000
commitec2e9174ac9fad2b6550fc0c194f34e46712f2f1 (patch)
treeecd56edd9dd6babb3cb0a1e2f97fb565a31911a0 /thread.c
parent5f0e9a175bb48f826f3eac5df04dc62349b2c5b4 (diff)
downloadruby-ec2e9174ac9fad2b6550fc0c194f34e46712f2f1.tar.gz
* thread.c (thread_start_func_2): don't interrupt when last thread exit
unless main thread is already exited. Otherwise main thread could be wrongly interrupted when it uses rb_thread_call_without_gvl(). Patch by Takehiro Kubo. [Bug #11237][ruby-dev:49044][GH-898] * test/-ext-/gvl/test_last_thread.rb: new test for the above fix. * ext/-test-/gvl/call_without_gvl/call_without_gvl.c: new ext for the above test. * ext/-test-/gvl/call_without_gvl/extconf.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/thread.c b/thread.c
index bf045a44ea..8e8d8fbdfe 100644
--- a/thread.c
+++ b/thread.c
@@ -629,7 +629,7 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
/* delete self other than main thread from living_threads */
rb_vm_living_threads_remove(th->vm, th);
- if (rb_thread_alone()) {
+ if (main_th->status == THREAD_KILLED && rb_thread_alone()) {
/* I'm last thread. wake up main thread from rb_thread_terminate_all */
rb_threadptr_interrupt(main_th);
}