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