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