make disallow_kill an int for nested unkillables (closes #2782)

This commit is contained in:
Ben Blum 2012-07-05 19:55:01 -04:00
parent 7f56d74072
commit 7b3add0632
3 changed files with 7 additions and 6 deletions

View file

@ -609,7 +609,7 @@ mod tests {
#[test] #[should_fail] #[ignore(cfg(windows))]
fn test_asymmetric_link() {
let l = create::<int>();
let one = l.push_n(1);
let _one = l.push_n(1);
let two = l.push_n(2);
two.prev = none;
l.assert_consistent();

View file

@ -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--;
}
//

View file

@ -181,7 +181,7 @@ private:
bool killed;
// Indicates that we've called back into Rust from C
bool reentered_rust_stack;
bool disallow_kill;
int disallow_kill;
// The stack used for running C code, borrowed from the scheduler thread
stk_seg *c_stack;