From 14306756b4a4f5f83043e3c2f91169a151fd54f5 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 2 Mar 2012 15:14:52 -0800 Subject: rt: Always delete task stacks on the task thread There's not a real race here, but it makes helgrind happy and is arguably less prone to future errrors. --- src/rt/rust_task.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/rt/rust_task.cpp') diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index c6d1ce4f100..106190d76f8 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -121,13 +121,6 @@ rust_task::delete_this() I(thread, ref_count == 0); // || // (ref_count == 1 && this == sched->root_task)); - // Delete all the stacks. There may be more than one if the task failed - // and no landing pads stopped to clean up. - // FIXME: We should do this when the task exits, not in the destructor - while (stk != NULL) { - del_stack(); - } - thread->release_task(this); } @@ -725,6 +718,16 @@ rust_task::check_stack_canary() { ::check_stack_canary(stk); } +void +rust_task::delete_all_stacks() { + I(thread, !on_rust_stack()); + // Delete all the stacks. There may be more than one if the task failed + // and no landing pads stopped to clean up. + while (stk != NULL) { + del_stack(); + } +} + void rust_task::config_notify(chan_handle chan) { notify_enabled = true; -- cgit 1.4.1-3-g733a5