]> git.lizzy.rs Git - rust.git/commitdiff
Temporary workaround to prevent taskgroup cleanup code from failing without an except...
authorBen Blum <bblum@andrew.cmu.edu>
Wed, 31 Jul 2013 23:48:38 +0000 (19:48 -0400)
committerBen Blum <bblum@andrew.cmu.edu>
Thu, 1 Aug 2013 21:07:31 +0000 (17:07 -0400)
src/libstd/rt/kill.rs
src/libstd/rt/task.rs

index 208af522d80e1166fdce0ea45039a6000035d66c..696f4a8c35515083457f44a63de9a28ed705c932 100644 (file)
@@ -72,6 +72,7 @@
 use option::{Option, Some, None};
 use prelude::*;
 use rt::task::Task;
+use task::spawn::Taskgroup;
 use to_bytes::IterBytes;
 use unstable::atomics::{AtomicUint, Relaxed};
 use unstable::sync::{UnsafeAtomicRcBox, LittleLock};
@@ -474,7 +475,7 @@ pub fn new_child(&self) -> Death {
     }
 
     /// Collect failure exit codes from children and propagate them to a parent.
-    pub fn collect_failure(&mut self, mut success: bool) {
+    pub fn collect_failure(&mut self, mut success: bool, group: Option<Taskgroup>) {
         // This may run after the task has already failed, so even though the
         // task appears to need to be killed, the scheduler should not fail us
         // when we block to unwrap.
@@ -484,6 +485,10 @@ pub fn collect_failure(&mut self, mut success: bool) {
         rtassert!(self.unkillable == 0);
         self.unkillable = 1;
 
+        // FIXME(#7544): See corresponding fixme at the callsite in task.rs.
+        // NB(#8192): Doesn't work with "let _ = ..."
+        { use util; util::ignore(group); }
+
         // Step 1. Decide if we need to collect child failures synchronously.
         do self.on_exit.take_map |on_exit| {
             if success {
index c1b799796d1587e067d9a3a2192141c6de02636e..f7f1b10e58c763c70aa25268aa0ecc31f846cb51 100644 (file)
@@ -129,8 +129,13 @@ pub fn run(&mut self, f: &fn()) {
         }
 
         self.unwinder.try(f);
-        { let _ = self.taskgroup.take(); }
-        self.death.collect_failure(!self.unwinder.unwinding);
+        // FIXME(#7544): We pass the taskgroup into death so that it can be
+        // dropped while the unkillable counter is set. This should not be
+        // necessary except for an extraneous clone() in task/spawn.rs that
+        // causes a killhandle to get dropped, which mustn't receive a kill
+        // signal since we're outside of the unwinder's try() scope.
+        // { let _ = self.taskgroup.take(); }
+        self.death.collect_failure(!self.unwinder.unwinding, self.taskgroup.take());
         self.destroy();
     }