Skip to content

Commit 49ab124

Browse files
committed
---
yaml --- r: 31676 b: refs/heads/dist-snap c: a3dd67a h: refs/heads/master v: v3
1 parent 65ac439 commit 49ab124

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
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 6bd01d0ac804a5a839a4513907b5697e35c8ad2e
10+
refs/heads/dist-snap: a3dd67ae9165ee87c98ba7e5585ce859fd3fbe68
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/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)