rust/src/test/run-pass/task-comm-0.rs

23 lines
400 B
Rust
Raw Normal View History

use std;
import std::comm;
2011-07-27 07:19:39 -05:00
fn main() { test05(); }
fn test05_start(pch: *u8) {
let ch = comm::chan_from_unsafe_ptr(pch);
ch.send(10);
ch.send(20);
ch.send(30);
}
2011-04-19 15:35:49 -05:00
fn test05() {
let po = comm::mk_port[int]();
let ch = po.mk_chan();
spawn test05_start(ch.unsafe_ptr());
let value = po.recv();
value = po.recv();
value = po.recv();
assert (value == 30);
2011-07-27 07:19:39 -05:00
}