rust/src/test/run-pass/task-comm-10.rs
2012-07-25 15:15:46 -07:00

28 lines
457 B
Rust

use std;
import task;
import pipes;
fn start(c: pipes::chan<pipes::chan<~str>>) {
let (ch, p) = pipes::stream();
c.send(ch);
let mut a;
let mut b;
a = p.recv();
assert a == ~"A";
log(error, a);
b = p.recv();
assert b == ~"B";
log(error, b);
}
fn main() {
let (ch, p) = pipes::stream();
let child = task::spawn(|| start(ch) );
let c = p.recv();
c.send(~"A");
c.send(~"B");
task::yield();
}