summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-15 14:00:11 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-15 14:00:11 +0000
commit2910f6736e09d1faa3b06db65e44193bdd2077c0 (patch)
treef521f2ed2842dff461c44c50acc9cbe607821391 /vm.c
parentac43a903b061c8e04e25efa457ca21c7e49cc693 (diff)
* cont.c (rb_fiber_reset_root_local_storage): add a new function to
restore rb_thread_t::local_storage. * cont.c (rb_obj_is_fiber): add a new function to tell finalizer to prevent fibers from destroy. * gc.c (rb_objspace_call_finalizer): don't sweep fibers at finalizing objspace. * internal.h (rb_fiber_reset_root_local_storage, rb_obj_is_fiber): add prototypes. * vm.c (ruby_vm_destruct): reset main thread's local_storage before free main thread. rb_thread_t::local_storage is replaced by fiber's local storage when forked from fiber, and it should be already freed when the fiber was destroyed. * test/ruby/test_fiber.rb (test_fork_from_fiber): add test for fork from fiber. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index 86217098cb..1d343cecf9 100644
--- a/vm.c
+++ b/vm.c
@@ -1611,6 +1611,7 @@ ruby_vm_destruct(rb_vm_t *vm)
rb_gc_force_recycle(vm->self);
vm->main_thread = 0;
if (th) {
+ rb_fiber_reset_root_local_storage(th->self);
thread_free(th);
}
if (vm->living_threads) {