about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcore/dlist.rs2
-rw-r--r--src/rt/rust_task.cpp9
-rw-r--r--src/rt/rust_task.h2
3 files changed, 7 insertions, 6 deletions
diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs
index f80972d50b3..c66f094eec0 100644
--- a/src/libcore/dlist.rs
+++ b/src/libcore/dlist.rs
@@ -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();
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--;
 }
 
 //
diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h
index f92682ec007..96b0bddd4e0 100644
--- a/src/rt/rust_task.h
+++ b/src/rt/rust_task.h
@@ -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;