Last active
December 11, 2015 18:49
-
-
Save 14427/4644469 to your computer and use it in GitHub Desktop.
This code fails an assertion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use pipes::*; | |
use task::spawn; | |
fn main() { | |
let (p1, c1) = pipes::stream(); | |
let (p2, c2) = pipes::stream(); | |
do spawn { | |
for int::range(1, 7) |i| { | |
c1.send(i); | |
} | |
} | |
do spawn { | |
for 3.times { | |
c2.send(true); | |
} | |
} | |
let mut ports = ~[p1.header(), p2.header()]; | |
loop { | |
match selecti(ports) { | |
0 => { | |
match p1.try_recv() { | |
Some(n) => error!("Number: %?", n), | |
None => break, | |
} | |
} | |
1 => { | |
match p1.try_recv() { | |
Some(b) => error!("Bool: %?", b), | |
None => break, | |
} | |
} | |
_ => fail, | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment