Skip to content

Commit ca81908

Browse files
tedhorstcatamorphism
authored andcommitted
---
yaml --- r: 39658 b: refs/heads/incoming c: 7c79b5e h: refs/heads/master v: v3
1 parent 06e68cb commit ca81908

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
@@ -6,7 +6,7 @@ refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
9-
refs/heads/incoming: b1698890059306fe027d36c3f8f5270c9bcaba96
9+
refs/heads/incoming: 7c79b5e434b93f07fda1853e06abafb3758b151f
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/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)