From 7b3add0632f65865159af1ee35933c4e61d41f8b Mon Sep 17 00:00:00 2001 From: Ben Blum Date: Thu, 5 Jul 2012 19:55:01 -0400 Subject: make disallow_kill an int for nested unkillables (closes #2782) --- src/rt/rust_task.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/rt/rust_task.cpp') diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index a6ad35b5a57..d7d43bcd27d 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -38,7 +38,7 @@ rust_task::rust_task(rust_sched_loop *sched_loop, rust_task_state state, cond_name("none"), killed(false), reentered_rust_stack(false), - disallow_kill(false), + disallow_kill(0), c_stack(NULL), next_c_sp(0), next_rust_sp(0), @@ -237,7 +237,7 @@ rust_task::must_fail_from_being_killed() { bool rust_task::must_fail_from_being_killed_unlocked() { kill_lock.must_have_lock(); - return killed && !reentered_rust_stack && !disallow_kill; + return killed && !reentered_rust_stack && disallow_kill == 0; } // Only run this on the rust stack @@ -683,13 +683,14 @@ rust_task::on_rust_stack() { void rust_task::inhibit_kill() { scoped_lock with(kill_lock); - disallow_kill = true; + disallow_kill++; } void rust_task::allow_kill() { scoped_lock with(kill_lock); - disallow_kill = false; + assert(disallow_kill > 0 && "Illegal allow_kill(): already killable!"); + disallow_kill--; } // -- cgit 1.4.1-3-g733a5