File tree Expand file tree Collapse file tree 2 files changed +13
-13
lines changed
branches/dist-snap/src/test/bench Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9
9
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10
- refs/heads/dist-snap: 1d04b0ed5ac829594a412298cb9f9455d1a4d843
10
+ refs/heads/dist-snap: f76a46242b6a34ac09643ddf4050be9d1ad11573
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -15,33 +15,33 @@ use std;
15
15
import std:: { time, getopts} ;
16
16
import io:: writer_util;
17
17
import int:: range;
18
- import comm :: port;
19
- import comm :: chan;
20
- import comm :: send;
21
- import comm :: recv;
18
+ import pipes :: port;
19
+ import pipes :: chan;
20
+ import pipes :: send;
21
+ import pipes :: recv;
22
22
23
23
import core:: result;
24
24
import result:: { ok, err} ;
25
25
26
26
fn fib ( n : int ) -> int {
27
27
fn pfib ( c : chan < int > , n : int ) {
28
28
if n == 0 {
29
- send ( c , 0 ) ;
29
+ c . send ( 0 ) ;
30
30
} else if n <= 2 {
31
- send ( c , 1 ) ;
31
+ c . send ( 1 ) ;
32
32
} else {
33
- let p = port ( ) ;
34
- let ch = chan ( p ) ;
33
+ let p = pipes :: port_set ( ) ;
34
+ let ch = p . chan ( ) ;
35
35
task:: spawn ( || pfib ( ch, n - 1 ) ) ;
36
+ let ch = p. chan ( ) ;
36
37
task:: spawn ( || pfib ( ch, n - 2 ) ) ;
37
- send ( c , recv ( p ) + recv ( p ) ) ;
38
+ c . send ( p . recv ( ) + p . recv ( ) ) ;
38
39
}
39
40
}
40
41
41
- let p = port ( ) ;
42
- let ch = chan ( p) ;
42
+ let ( ch, p) = pipes:: stream ( ) ;
43
43
let t = task:: spawn ( || pfib ( ch, n) ) ;
44
- return recv ( p ) ;
44
+ p . recv ( )
45
45
}
46
46
47
47
type config = { stress : bool } ;
You can’t perform that action at this time.
0 commit comments