From d5e7f0d1134c41757901ccb9e944974042ee3d93 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 14 Feb 2012 00:43:45 -0800 Subject: rt: Don't kill tasks while they are in a callback from C --- src/rt/rust_task.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/rt/rust_task.cpp') diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 65568ad8ed5..14c223ddb91 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -84,11 +84,12 @@ rust_task::rust_task(rust_task_thread *thread, rust_task_list *state, local_region(&thread->srv->local_region), boxed(&local_region), unwinding(false), - killed(false), propagate_failure(true), dynastack(this), cc_counter(0), total_stack_sz(0), + killed(false), + reentered_rust_stack(false), c_stack(NULL), next_c_sp(0), next_rust_sp(0) @@ -240,17 +241,22 @@ void rust_task::start() transition(&thread->newborn_tasks, &thread->running_tasks); } +bool +rust_task::must_fail_from_being_killed() { + return killed && !reentered_rust_stack; +} + // Only run this on the rust stack void rust_task::yield(bool *killed) { - if (this->killed) { + if (must_fail_from_being_killed()) { *killed = true; } // Return to the scheduler. ctx.next->swap(ctx); - if (this->killed) { + if (must_fail_from_being_killed()) { *killed = true; } } -- cgit 1.4.1-3-g733a5