2011-07-12 17:27:17 -05:00
|
|
|
use std;
|
|
|
|
import std::task;
|
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
fn start(c: chan[chan[str]]) {
|
|
|
|
let p: port[str];
|
2011-07-18 14:02:26 -05:00
|
|
|
|
2011-07-28 20:01:27 -05:00
|
|
|
let a;
|
|
|
|
let b;
|
2011-07-18 14:02:26 -05:00
|
|
|
p = port();
|
2010-08-11 17:05:33 -05:00
|
|
|
c <| chan(p);
|
2011-07-18 14:02:26 -05:00
|
|
|
p |> a;
|
|
|
|
log_err a;
|
|
|
|
p |> b;
|
|
|
|
log_err b;
|
2010-08-11 17:05:33 -05:00
|
|
|
}
|
|
|
|
|
2011-04-19 15:35:49 -05:00
|
|
|
fn main() {
|
2011-07-27 07:19:39 -05:00
|
|
|
let p: port[chan[str]];
|
|
|
|
let child;
|
2011-07-18 14:02:26 -05:00
|
|
|
|
|
|
|
p = port();
|
|
|
|
child = spawn start(chan(p));
|
2011-07-27 07:19:39 -05:00
|
|
|
let c;
|
2011-07-18 14:02:26 -05:00
|
|
|
|
|
|
|
p |> c;
|
2010-08-11 17:05:33 -05:00
|
|
|
c <| "A";
|
|
|
|
c <| "B";
|
2011-07-12 17:27:17 -05:00
|
|
|
task::yield();
|
2011-07-27 07:19:39 -05:00
|
|
|
}
|