Skip to content

Commit 4242c33

Browse files
committed
---
yaml --- r: 23014 b: refs/heads/master c: a3dd67a h: refs/heads/master v: v3
1 parent 7e517d5 commit 4242c33

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,5 +1,5 @@
11
---
2-
refs/heads/master: 6bd01d0ac804a5a839a4513907b5697e35c8ad2e
2+
refs/heads/master: a3dd67ae9165ee87c98ba7e5585ce859fd3fbe68
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/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)