]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/send-iloop.rs
b119ac6eb1d21064a6db5651357b6c11d0fe5448
[rust.git] / src / test / run-pass / send-iloop.rs
1 // xfail-win32
2 use std;
3 import task;
4 import comm;
5 import uint;
6
7 fn die(&&_i: ()) {
8     fail;
9 }
10
11 fn iloop(&&_i: ()) {
12     task::unsupervise();
13     task::spawn((), die);
14     let p = comm::port::<()>();
15     let c = comm::chan(p);
16     while true {
17         // Sending and receiving here because these actions yield,
18         // at which point our child can kill us
19         comm::send(c, ());
20         comm::recv(p);
21     }
22 }
23
24 fn main() {
25     uint::range(0u, 16u) {|_i|
26         task::spawn((), iloop);
27     }
28 }