2011-11-11 19:08:50 -06:00
|
|
|
use std;
|
2011-12-13 18:25:51 -06:00
|
|
|
import comm::*;
|
|
|
|
import task::*;
|
2011-11-11 19:08:50 -06:00
|
|
|
|
|
|
|
fn a(&&_args: ()) {
|
|
|
|
fn doit() {
|
|
|
|
fn b(c: chan<chan<int>>) {
|
|
|
|
let p = port();
|
|
|
|
send(c, chan(p));
|
|
|
|
}
|
|
|
|
let p = port();
|
|
|
|
spawn(chan(p), b);
|
|
|
|
recv(p);
|
|
|
|
}
|
|
|
|
let i = 0;
|
|
|
|
while i < 100 {
|
|
|
|
doit();
|
|
|
|
i += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let t = spawn_joinable((), a);
|
|
|
|
join(t);
|
|
|
|
}
|