[前][次][番号順一覧][スレッド一覧]

ruby-changes:13832

From: wanabe <ko1@a...>
Date: Mon, 2 Nov 2009 18:35:57 +0900 (JST)
Subject: [ruby-changes:13832] Ruby:r25631 (trunk): * cont.c (fiber_free): don't free unallocated local_storage. see #1325.

wanabe	2009-11-02 18:35:43 +0900 (Mon, 02 Nov 2009)

  New Revision: 25631

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25631

  Log:
    * cont.c (fiber_free): don't free unallocated local_storage. see #1325.
    
    * cont.c (cont_init): clear local_storage not to use current thread's.
    
    * cont.c (fiber_t_alloc, root_fiber_alloc): link itself always for
      a case that fiber_link_remove() is called before fiber_link_join().
    
    * cont.c (fiber_init): clear cont->vm_stack and th->stack before
      root_fiber_alloc() in rb_fiber_current().

  Modified files:
    trunk/ChangeLog
    trunk/cont.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 25630)
+++ ChangeLog	(revision 25631)
@@ -1,3 +1,15 @@
+Mon Nov  2 18:33:21 2009  wanabe  <s.wanabe@g...>
+
+	* cont.c (fiber_free): don't free unallocated local_storage. see #1325.
+
+	* cont.c (cont_init): clear local_storage not to use current thread's.
+
+	* cont.c (fiber_t_alloc, root_fiber_alloc): link itself always for
+	  a case that fiber_link_remove() is called before fiber_link_join().
+
+	* cont.c (fiber_init): clear cont->vm_stack and th->stack before
+	  root_fiber_alloc() in rb_fiber_current().
+
 Mon Nov  2 14:52:53 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* eval.c (rb_exc_raise, rb_exc_fatal, rb_make_exception):
Index: cont.c
===================================================================
--- cont.c	(revision 25630)
+++ cont.c	(revision 25631)
@@ -198,7 +198,8 @@
     if (ptr) {
 	rb_fiber_t *fib = ptr;
 
-	if (fib->cont.type != ROOT_FIBER_CONTEXT) {
+	if (fib->cont.type != ROOT_FIBER_CONTEXT &&
+	    fib->cont.saved_thread.local_storage) {
 	    st_free_table(fib->cont.saved_thread.local_storage);
 	}
 	fiber_link_remove(fib);
@@ -283,6 +284,7 @@
 {
     /* save thread context */
     cont->saved_thread = *th;
+    cont->saved_thread.local_storage = 0;
 }
 
 static rb_context_t *
@@ -744,12 +746,15 @@
     rb_context_t *cont = &fib->cont;
     rb_thread_t *th = &cont->saved_thread;
 
-    fiber_link_join(fib);
 
     /* initialize cont */
     cont->vm_stack = 0;
 
     th->stack = 0;
+    th->stack_size = 0;
+
+    fiber_link_join(fib);
+
     th->stack_size = FIBER_VM_STACK_SIZE;
     th->stack = ALLOC_N(VALUE, th->stack_size);
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]