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
|
|
|
|
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);
|
2012-06-30 18:19:07 -05:00
|
|
|
spawn(|| b(ch) );
|
2011-11-11 19:08:50 -06:00
|
|
|
recv(p);
|
|
|
|
}
|
2012-03-22 10:39:41 -05:00
|
|
|
let mut i = 0;
|
2011-11-11 19:08:50 -06:00
|
|
|
while i < 100 {
|
|
|
|
doit();
|
|
|
|
i += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2012-07-04 14:04:28 -05:00
|
|
|
for iter::repeat(100u) {
|
2012-06-30 18:19:07 -05:00
|
|
|
spawn(|| a() );
|
2012-02-18 18:34:42 -06:00
|
|
|
}
|
2011-11-11 19:08:50 -06:00
|
|
|
}
|