about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorBen Blum <bblum@andrew.cmu.edu>2013-07-12 22:45:19 -0400
committerBen Blum <bblum@andrew.cmu.edu>2013-07-20 05:08:57 -0400
commit9bbec651dfff68c93d7213fceadecc21c324b0cb (patch)
treee24d1cf629094c67a166615d31b936e9b1855e97 /src/libstd/rt
parente2a42416ddab88f7ed076cb9a4fd6ecc70be3278 (diff)
downloadrust-9bbec651dfff68c93d7213fceadecc21c324b0cb.tar.gz
rust-9bbec651dfff68c93d7213fceadecc21c324b0cb.zip
Replace *rust_task ptrs in taskgroup code with TaskHandle, for transitioning to newsched killing.
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/kill.rs12
-rw-r--r--src/libstd/rt/task.rs5
2 files changed, 17 insertions, 0 deletions
diff --git a/src/libstd/rt/kill.rs b/src/libstd/rt/kill.rs
index 58e68cae253..b331442eb4b 100644
--- a/src/libstd/rt/kill.rs
+++ b/src/libstd/rt/kill.rs
@@ -16,6 +16,7 @@ use either::{Either, Left, Right};
 use option::{Option, Some, None};
 use prelude::*;
 use rt::task::Task;
+use to_bytes::IterBytes;
 use unstable::atomics::{AtomicUint, Acquire, SeqCst};
 use unstable::sync::{UnsafeAtomicRcBox, LittleLock};
 use util;
@@ -194,6 +195,17 @@ impl BlockedTask {
     }
 }
 
+// So that KillHandle can be hashed in the taskgroup bookkeeping code.
+impl IterBytes for KillHandle {
+    fn iter_bytes(&self, lsb0: bool, f: &fn(buf: &[u8]) -> bool) -> bool {
+        self.data.iter_bytes(lsb0, f)
+    }
+}
+impl Eq for KillHandle {
+    #[inline] fn eq(&self, other: &KillHandle) -> bool { self.data.eq(&other.data) }
+    #[inline] fn ne(&self, other: &KillHandle) -> bool { self.data.ne(&other.data) }
+}
+
 impl KillHandle {
     pub fn new() -> (KillHandle, KillFlagHandle) {
         let (flag, flag_clone) =
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs
index a1227dd180c..f6e2faf5bf1 100644
--- a/src/libstd/rt/task.rs
+++ b/src/libstd/rt/task.rs
@@ -27,6 +27,7 @@ use super::local_heap::LocalHeap;
 use rt::sched::{Scheduler, SchedHandle};
 use rt::stack::{StackSegment, StackPool};
 use rt::context::Context;
+use task::spawn::TCB;
 use cell::Cell;
 
 pub struct Task {
@@ -36,6 +37,7 @@ pub struct Task {
     logger: StdErrLogger,
     unwinder: Unwinder,
     home: Option<SchedHome>,
+    taskgroup: Option<TCB>,
     death: Death,
     destroyed: bool,
     coroutine: Option<~Coroutine>
@@ -85,6 +87,7 @@ impl Task {
             logger: StdErrLogger,
             unwinder: Unwinder { unwinding: false },
             home: Some(home),
+            taskgroup: None,
             death: Death::new(),
             destroyed: false,
             coroutine: Some(~Coroutine::new(stack_pool, start))
@@ -102,6 +105,7 @@ impl Task {
             logger: StdErrLogger,
             home: Some(home),
             unwinder: Unwinder { unwinding: false },
+            taskgroup: None,
             // FIXME(#7544) make watching optional
             death: self.death.new_child(),
             destroyed: false,
@@ -121,6 +125,7 @@ impl Task {
         }
 
         self.unwinder.try(f);
+        { let _ = self.taskgroup.take(); }
         self.death.collect_failure(!self.unwinder.unwinding);
         self.destroy();
     }