Skip to content

Commit febaba6

Browse files
committed
---
yaml --- r: 20906 b: refs/heads/snap-stage3 c: a3dd67a h: refs/heads/master v: v3
1 parent fcea5c4 commit febaba6

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 6bd01d0ac804a5a839a4513907b5697e35c8ad2e
4+
refs/heads/snap-stage3: a3dd67ae9165ee87c98ba7e5585ce859fd3fbe68
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/test/bench/task-perf-jargon-metal-smoke.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@
55
//
66
// The filename is a song reference; google it in quotes.
77

8-
fn child_generation(gens_left: uint) {
8+
fn child_generation(gens_left: uint, -c: pipes::chan<()>) {
99
// This used to be O(n^2) in the number of generations that ever existed.
1010
// With this code, only as many generations are alive at a time as tasks
1111
// alive at a time,
12+
let c = ~mut some(c);
1213
do task::spawn_supervised {
14+
let c = option::swap_unwrap(c);
1315
if gens_left & 1 == 1 {
1416
task::yield(); // shake things up a bit
1517
}
1618
if gens_left > 0 {
17-
child_generation(gens_left - 1); // recurse
19+
child_generation(gens_left - 1, c); // recurse
20+
} else {
21+
c.send(())
1822
}
1923
}
2024
}
@@ -28,5 +32,9 @@ fn main(args: ~[~str]) {
2832
copy args
2933
};
3034

31-
child_generation(uint::from_str(args[1]).get());
35+
let (c,p) = pipes::stream();
36+
child_generation(uint::from_str(args[1]).get(), c);
37+
if p.try_recv().is_none() {
38+
fail ~"it happened when we slumbered";
39+
}
3240
}

0 commit comments

Comments
 (0)