blob: 532daf3651c859aa182a26e5caad4acb18b4df70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use std;
import comm;
import comm::chan;
import comm::send;
import task;
fn main() { test05(); }
fn test05_start(ch : chan<int>) {
log(error, ch);
send(ch, 10);
#error("sent 10");
send(ch, 20);
#error("sent 20");
send(ch, 30);
#error("sent 30");
}
fn test05() {
let po = comm::port();
let ch = comm::chan(po);
task::spawn(|| test05_start(ch) );
let mut value = comm::recv(po);
log(error, value);
value = comm::recv(po);
log(error, value);
value = comm::recv(po);
log(error, value);
assert (value == 30);
}
|