]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/issue-3168.rs
609849bffb4887b354af242e4fe0a3468d852d36
[rust.git] / src / test / run-pass / issue-3168.rs
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // xfail-fast
12 // xfail-win32 #7999
13
14 use std::comm;
15 use std::task;
16
17 pub fn main() {
18     let (p,c) = comm::stream();
19     do task::try || {
20         let (p2,c2) = comm::stream();
21         do task::spawn || {
22             p2.recv();
23             error!("sibling fails");
24             fail!();
25         }
26         let (p3,c3) = comm::stream();
27         c.send(c3);
28         c2.send(());
29         error!("child blocks");
30         p3.recv();
31     };
32     error!("parent tries");
33     assert!(!p.recv().try_send(()));
34     error!("all done!");
35 }