28 lines
422 B
Rust
Raw Normal View History

2011-11-11 17:08:50 -08:00
use std;
import comm::*;
import task::*;
2011-11-11 17:08:50 -08:00
2012-01-04 21:14:53 -08:00
fn a() {
2011-11-11 17:08:50 -08:00
fn doit() {
2012-08-15 14:10:46 -07:00
fn b(c: Chan<Chan<int>>) {
2011-11-11 17:08:50 -08:00
let p = port();
send(c, chan(p));
}
let p = port();
2012-01-04 21:14:53 -08:00
let ch = chan(p);
2012-06-30 16:19:07 -07:00
spawn(|| b(ch) );
2011-11-11 17:08:50 -08:00
recv(p);
}
let mut i = 0;
2011-11-11 17:08:50 -08:00
while i < 100 {
doit();
i += 1;
}
}
fn main() {
for iter::repeat(100u) {
2012-06-30 16:19:07 -07:00
spawn(|| a() );
2012-02-18 16:34:42 -08:00
}
2011-11-11 17:08:50 -08:00
}