Skip to content

Commit bd64783

Browse files
tedhorstcatamorphism
authored andcommitted
---
yaml --- r: 52095 b: refs/heads/dist-snap c: 7c79b5e h: refs/heads/master i: 52093: 6e88792 52091: 4668dab 52087: 9da9157 52079: 63acf28 52063: 1496704 52031: bd24528 51967: d089c10 v: v3
1 parent 8ccb139 commit bd64783

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: b1698890059306fe027d36c3f8f5270c9bcaba96
10+
refs/heads/dist-snap: 7c79b5e434b93f07fda1853e06abafb3758b151f
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/test/bench/shootout-mandelbrot.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fn fillbyte(x: cmplx, incr: f64) -> u8 {
8383
rv
8484
}
8585

86-
fn chanmb(i: uint, size: uint, ch: oldcomm::Chan<Line>) -> ()
86+
fn chanmb(i: uint, size: uint) -> Line
8787
{
8888
let mut crv = ~[];
8989
let incr = 2f64/(size as f64);
@@ -93,7 +93,7 @@ fn chanmb(i: uint, size: uint, ch: oldcomm::Chan<Line>) -> ()
9393
let x = cmplx {re: xincr*(j as f64) - 1.5f64, im: y};
9494
crv.push(fillbyte(x, incr));
9595
};
96-
oldcomm::send(ch, Line {i:i, b: move crv});
96+
Line {i:i, b:crv}
9797
}
9898

9999
type devnull = {dn: int};
@@ -106,11 +106,8 @@ impl devnull: io::Writer {
106106
fn get_type(&self) -> io::WriterType { io::File }
107107
}
108108

109-
fn writer(path: ~str, writech: oldcomm::Chan<oldcomm::Chan<Line>>, size: uint)
109+
fn writer(path: ~str, pport: pipes::Port<Line>, size: uint)
110110
{
111-
let p: oldcomm::Port<Line> = oldcomm::Port();
112-
let ch = oldcomm::Chan(&p);
113-
oldcomm::send(writech, ch);
114111
let cout: io::Writer = match path {
115112
~"" => {
116113
{dn: 0} as io::Writer
@@ -130,7 +127,7 @@ fn writer(path: ~str, writech: oldcomm::Chan<oldcomm::Chan<Line>>, size: uint)
130127
let mut done = 0_u;
131128
let mut i = 0_u;
132129
while i < size {
133-
let aline = oldcomm::recv(p);
130+
let aline = pport.recv();
134131
if aline.i == done {
135132
debug!("W %u", aline.i);
136133
cout.write(aline.b);
@@ -171,13 +168,11 @@ fn main() {
171168
let size = if vec::len(args) < 2_u { 80_u }
172169
else { uint::from_str(args[1]).get() };
173170

174-
let writep = oldcomm::Port();
175-
let writech = oldcomm::Chan(&writep);
176-
do task::spawn |move path| {
177-
writer(copy path, writech, size);
178-
};
179-
let ch = oldcomm::recv(writep);
171+
let (pport, pchan) = pipes::stream();
172+
let pchan = pipes::SharedChan(pchan);
180173
for uint::range(0_u, size) |j| {
181-
do task::spawn { chanmb(j, size, ch) };
174+
let cchan = pchan.clone();
175+
do task::spawn |move cchan| { cchan.send(chanmb(j, size)) };
182176
};
177+
writer(path, pport, size);
183178
}

0 commit comments

Comments
 (0)