diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-05 19:55:01 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-05 19:56:09 -0400 |
| commit | 7b3add0632f65865159af1ee35933c4e61d41f8b (patch) | |
| tree | 1688463a649a5c405e4579368b97287d5a2e21a1 /src/rt/rust_task.cpp | |
| parent | 7f56d740726d296b5658173a43c02a681879374a (diff) | |
| download | rust-7b3add0632f65865159af1ee35933c4e61d41f8b.tar.gz rust-7b3add0632f65865159af1ee35933c4e61d41f8b.zip | |
make disallow_kill an int for nested unkillables (closes #2782)
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
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--; } // |
