Skip to content

Commit 1c41e6b

Browse files
committed
---
yaml --- r: 6748 b: refs/heads/master c: 34283c6 h: refs/heads/master v: v3
1 parent f0356d1 commit 1c41e6b

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 4465c1ad022740eb9204f3111396be6b16351632
2+
refs/heads/master: 34283c6a7863d5d69641f5c39422db70fe6c862a
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
use std;
2+
3+
import std::comm;
4+
import std::comm::chan;
5+
import std::comm::send;
6+
7+
fn main() { test05(); }
8+
9+
type pair<A,B> = { a: A, b: B };
10+
11+
fn make_generic_record<copy A,copy B>(a: A, b: B) -> pair<A,B> {
12+
ret {a: a, b: b};
13+
}
14+
15+
fn test05_start(&&f: sendfn(&&float, &&str) -> pair<float, str>) {
16+
let p = f(22.22f, "Hi");
17+
log p;
18+
assert p.a == 22.22f;
19+
assert p.b == "Hi";
20+
21+
let q = f(44.44f, "Ho");
22+
log q;
23+
assert q.a == 44.44f;
24+
assert q.b == "Ho";
25+
}
26+
27+
fn spawn<copy A, copy B>(f: fn(sendfn(A,B)->pair<A,B>)) {
28+
let arg = sendfn(a: A, b: B) -> pair<A,B> {
29+
ret make_generic_record(a, b);
30+
};
31+
task::spawn(arg, f);
32+
}
33+
34+
fn test05() {
35+
spawn::<float,str>(test05_start);
36+
}

0 commit comments

Comments
 (0)