From fd2f238560fb1dfc664036618f05eaa9ebc8cbaa Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 12 Jan 2011 10:35:36 +0000 Subject: [PATCH] * vm.c (thread_free): reset ruby_current_thread if it points the thread to free. * gc.c (slot_sweep): don't call RUBY_VM_SET_FINALIZER_INTERRUPT if there is no current thread. [ruby-dev:43000] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ gc.c | 5 ++++- vm.c | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 359bdb72c9..21a5c985eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Wed Jan 12 19:28:23 2011 Tanaka Akira + + * vm.c (thread_free): reset ruby_current_thread if it points the + thread to free. + * gc.c (slot_sweep): don't call RUBY_VM_SET_FINALIZER_INTERRUPT if + there is no current thread. + [ruby-dev:43000] + Wed Jan 12 19:09:29 2011 Tanaka Akira * enum.c (sort_by_i): reenter check more strictly. diff --git a/gc.c b/gc.c index 04e87d38ef..39979138bb 100644 --- a/gc.c +++ b/gc.c @@ -1958,7 +1958,10 @@ slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot) objspace->heap.final_num += final_num; if (deferred_final_list) { - RUBY_VM_SET_FINALIZER_INTERRUPT(GET_THREAD()); + rb_thread_t *th = GET_THREAD(); + if (th) { + RUBY_VM_SET_FINALIZER_INTERRUPT(th); + } } } diff --git a/vm.c b/vm.c index f467055f92..130ca64160 100644 --- a/vm.c +++ b/vm.c @@ -1730,6 +1730,8 @@ thread_free(void *ptr) #endif ruby_xfree(ptr); } + if (ruby_current_thread == th) + ruby_current_thread = NULL; } RUBY_FREE_LEAVE("thread"); }