Skip to content

Commit 5ac8c57

Browse files
committed
Clean up transitionary glue in task/spawn.rs. Don't hold kill-little-lock for O(n) time, cf rust-lang#3100, and optimize out several unneeded clone()s.
1 parent ce48e71 commit 5ac8c57

File tree

4 files changed

+69
-138
lines changed

4 files changed

+69
-138
lines changed

src/libstd/rt/kill.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,8 @@ impl Death {
488488
rtassert!(self.unkillable == 0);
489489
self.unkillable = 1;
490490

491-
// FIXME(#7544): See corresponding fixme at the callsite in task.rs.
492-
// NB(#8192): Doesn't work with "let _ = ..."
491+
// NB. See corresponding comment at the callsite in task.rs.
492+
// FIXME(#8192): Doesn't work with "let _ = ..."
493493
{ use util; util::ignore(group); }
494494

495495
// Step 1. Decide if we need to collect child failures synchronously.

src/libstd/rt/task.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,10 @@ impl Task {
253253
}
254254
}
255255

256-
// FIXME(#7544): We pass the taskgroup into death so that it can be
257-
// dropped while the unkillable counter is set. This should not be
258-
// necessary except for an extraneous clone() in task/spawn.rs that
259-
// causes a killhandle to get dropped, which mustn't receive a kill
260-
// signal since we're outside of the unwinder's try() scope.
261-
// { let _ = self.taskgroup.take(); }
256+
// NB. We pass the taskgroup into death so that it can be dropped while
257+
// the unkillable counter is set. This is necessary for when the
258+
// taskgroup destruction code drops references on KillHandles, which
259+
// might require using unkillable (to synchronize with an unwrapper).
262260
self.death.collect_failure(!self.unwinder.unwinding, self.taskgroup.take());
263261
self.destroyed = true;
264262
}

src/libstd/task/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
use prelude::*;
3939

4040
use cell::Cell;
41-
use cmp::Eq;
4241
use comm::{stream, Chan, GenericChan, GenericPort, Port};
4342
use result::Result;
4443
use result;

0 commit comments

Comments
 (0)