rust/src/test/run-pass/task-comm-13.rs

17 lines
375 B
Rust
Raw Normal View History

use std;
import task;
2012-07-25 16:05:06 -05:00
import pipes;
import pipes::send;
2012-08-28 13:11:15 -05:00
fn start(c: pipes::Chan<int>, start: int, number_of_messages: int) {
let mut i: int = 0;
2012-07-25 16:05:06 -05:00
while i < number_of_messages { c.send(start + i); i += 1; }
}
2011-07-27 07:19:39 -05:00
fn main() {
2012-08-22 19:24:52 -05:00
debug!("Check that we don't deadlock.");
2012-07-25 16:05:06 -05:00
let (ch, p) = pipes::stream();
2012-06-30 18:19:07 -05:00
task::try(|| start(ch, 0, 10) );
2012-08-22 19:24:52 -05:00
debug!("Joined task");
2011-08-12 19:36:52 -05:00
}