Skip to content

Commit 963d37e

Browse files
committed
Temporary workaround to prevent taskgroup cleanup code from failing without an exception handler.
1 parent aeaed77 commit 963d37e

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/libstd/rt/kill.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ use either::{Either, Left, Right};
7272
use option::{Option, Some, None};
7373
use prelude::*;
7474
use rt::task::Task;
75+
use task::spawn::Taskgroup;
7576
use to_bytes::IterBytes;
7677
use unstable::atomics::{AtomicUint, Relaxed};
7778
use unstable::sync::{UnsafeAtomicRcBox, LittleLock};
@@ -474,7 +475,7 @@ impl Death {
474475
}
475476

476477
/// Collect failure exit codes from children and propagate them to a parent.
477-
pub fn collect_failure(&mut self, mut success: bool) {
478+
pub fn collect_failure(&mut self, mut success: bool, group: Option<Taskgroup>) {
478479
// This may run after the task has already failed, so even though the
479480
// task appears to need to be killed, the scheduler should not fail us
480481
// when we block to unwrap.
@@ -484,6 +485,10 @@ impl Death {
484485
rtassert!(self.unkillable == 0);
485486
self.unkillable = 1;
486487

488+
// FIXME(#7544): See corresponding fixme at the callsite in task.rs.
489+
// NB(#8192): Doesn't work with "let _ = ..."
490+
{ use util; util::ignore(group); }
491+
487492
// Step 1. Decide if we need to collect child failures synchronously.
488493
do self.on_exit.take_map |on_exit| {
489494
if success {

src/libstd/rt/task.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,13 @@ impl Task {
129129
}
130130

131131
self.unwinder.try(f);
132-
{ let _ = self.taskgroup.take(); }
133-
self.death.collect_failure(!self.unwinder.unwinding);
132+
// FIXME(#7544): We pass the taskgroup into death so that it can be
133+
// dropped while the unkillable counter is set. This should not be
134+
// necessary except for an extraneous clone() in task/spawn.rs that
135+
// causes a killhandle to get dropped, which mustn't receive a kill
136+
// signal since we're outside of the unwinder's try() scope.
137+
// { let _ = self.taskgroup.take(); }
138+
self.death.collect_failure(!self.unwinder.unwinding, self.taskgroup.take());
134139
self.destroy();
135140
}
136141

0 commit comments

Comments
 (0)