From a53a08e1b980e5cf5f9707ef1d1f27b89ff7ed99 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 14 Feb 2012 11:58:27 -0800 Subject: rt: Don't allocate a C stack for tasks that already have one --- src/rt/rust_task_thread.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/rt/rust_task_thread.cpp') diff --git a/src/rt/rust_task_thread.cpp b/src/rt/rust_task_thread.cpp index fbcd164707f..dde16ad70bd 100644 --- a/src/rt/rust_task_thread.cpp +++ b/src/rt/rust_task_thread.cpp @@ -70,7 +70,7 @@ rust_task_thread::activate(rust_task *task) { task->ctx.next = &c_context; DLOG(this, task, "descheduling..."); lock.unlock(); - prepare_c_stack(); + prepare_c_stack(task); task->ctx.swap(c_context); unprepare_c_stack(); lock.lock(); @@ -367,9 +367,9 @@ rust_task_thread::exit() { // stack), because once we're on the Rust stack we won't have enough // room to do the allocation void -rust_task_thread::prepare_c_stack() { +rust_task_thread::prepare_c_stack(rust_task *task) { I(this, !extra_c_stack); - if (!cached_c_stack) { + if (!cached_c_stack && !task->have_c_stack()) { cached_c_stack = create_stack(kernel, C_STACK_SIZE); prepare_valgrind_stack(cached_c_stack); } -- cgit 1.4.1-3-g733a5