rust/src/test/run-pass/issue-783.rs

27 lines
413 B
Rust
Raw Normal View History

2011-11-11 19:08:50 -06:00
use std;
import comm::*;
import task::*;
2011-11-11 19:08:50 -06:00
2012-01-04 23:14:53 -06:00
fn a() {
2011-11-11 19:08:50 -06:00
fn doit() {
fn b(c: chan<chan<int>>) {
let p = port();
send(c, chan(p));
}
let p = port();
2012-01-04 23:14:53 -06:00
let ch = chan(p);
spawn {|| b(ch); };
2011-11-11 19:08:50 -06:00
recv(p);
}
let i = 0;
while i < 100 {
doit();
i += 1;
}
}
fn main() {
2012-01-04 23:14:53 -06:00
let t = spawn_joinable {|| a(); };
2011-11-11 19:08:50 -06:00
join(t);
}