2011-07-12 15:27:17 -07:00
|
|
|
use std;
|
|
|
|
import std::task;
|
2011-08-06 10:07:39 -07:00
|
|
|
import std::comm;
|
2011-07-12 15:27:17 -07:00
|
|
|
|
2011-09-16 11:29:40 -07:00
|
|
|
fn start(c: comm::chan<comm::chan<str>>) {
|
|
|
|
let p = comm::port();
|
|
|
|
comm::send(c, comm::chan(p));
|
2011-07-18 12:02:26 -07:00
|
|
|
|
2011-07-28 18:01:27 -07:00
|
|
|
let a;
|
|
|
|
let b;
|
2011-09-16 11:29:40 -07:00
|
|
|
a = comm::recv(p);
|
|
|
|
assert a == "A";
|
2011-07-18 12:02:26 -07:00
|
|
|
log_err a;
|
2011-09-16 11:29:40 -07:00
|
|
|
b = comm::recv(p);
|
|
|
|
assert b == "B";
|
2011-07-18 12:02:26 -07:00
|
|
|
log_err b;
|
2010-08-11 15:05:33 -07:00
|
|
|
}
|
|
|
|
|
2011-04-19 13:35:49 -07:00
|
|
|
fn main() {
|
2011-09-16 11:29:40 -07:00
|
|
|
let p = comm::port();
|
|
|
|
let child = task::spawn(bind start(comm::chan(p)));
|
2011-07-18 12:02:26 -07:00
|
|
|
|
2011-09-16 11:29:40 -07:00
|
|
|
let c = comm::recv(p);
|
|
|
|
comm::send(c, "A");
|
|
|
|
comm::send(c, "B");
|
2011-07-12 15:27:17 -07:00
|
|
|
task::yield();
|
2011-08-06 10:07:39 -07:00
|
|
|
}
|