about summary refs log tree commit diff
path: root/src/test/run-pass/task-comm-0.rs
blob: abd4819b3bdf80f2dcc9e42db7a9d7cc12c3f547 (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_err ch;
    send(ch, 10);
    log_err "sent 10";
    send(ch, 20);
    log_err "sent 20";
    send(ch, 30);
    log_err "sent 30";
}

fn test05() {
    let po = comm::port();
    let ch = comm::chan(po);
    task::spawn(ch, test05_start);
    let value = comm::recv(po);
    log_err value;
    value = comm::recv(po);
    log_err value;
    value = comm::recv(po);
    log_err value;
    assert (value == 30);
}