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

34 lines
394 B
Rust
Raw Normal View History

// xfail-stage0
use std;
import std::task;
2011-04-19 15:35:49 -05:00
fn start(chan[chan[str]] c) {
let port[str] p;
p = port();
2010-08-11 17:05:33 -05:00
c <| chan(p);
p |> a;
log_err a;
p |> b;
log_err b;
auto a;
auto b;
2010-08-11 17:05:33 -05:00
}
2011-04-19 15:35:49 -05:00
fn main() {
let port[chan[str]] p;
auto child;
p = port();
child = spawn start(chan(p));
p |> c;
2010-08-11 17:05:33 -05:00
c <| "A";
c <| "B";
task::yield();
auto c;
}