summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwanabe <wanabe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-02 09:35:43 +0000
committerwanabe <wanabe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-02 09:35:43 +0000
commit3d2de45d264b0b82c4ba72ce54600361e38aaba5 (patch)
treec1302ddab261e32c2e7d00ffdc2b2411a8acb44b
parent6e4122d1ba6b1abe51583fb36ef23f3d788d4a94 (diff)
downloadruby-3d2de45d264b0b82c4ba72ce54600361e38aaba5.tar.gz
ruby-3d2de45d264b0b82c4ba72ce54600361e38aaba5.tar.xz
ruby-3d2de45d264b0b82c4ba72ce54600361e38aaba5.zip
* 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(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog12
-rw-r--r--cont.c9
2 files changed, 19 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 8ef34a5d9..efc2edf0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Mon Nov 2 18:33:21 2009 wanabe <s.wanabe@gmail.com>
+
+ * 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@ruby-lang.org>
* eval.c (rb_exc_raise, rb_exc_fatal, rb_make_exception):
diff --git a/cont.c b/cont.c
index 9021333ba..f4f8d50fe 100644
--- a/cont.c
+++ b/cont.c
@@ -198,7 +198,8 @@ fiber_free(void *ptr)
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 @@ cont_init(rb_context_t *cont, rb_thread_t *th)
{
/* save thread context */
cont->saved_thread = *th;
+ cont->saved_thread.local_storage = 0;
}
static rb_context_t *
@@ -744,12 +746,15 @@ fiber_init(VALUE fibval, VALUE proc)
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);