PageRenderTime 13ms CodeModel.GetById 2ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/jruderman/rust
Rust | 16 lines | 14 code | 2 blank | 0 comment | 1 complexity | db4f52c1ec0729be6e73268f6fc9c206 MD5 | raw file
 1use std;
 2import task;
 3import pipes;
 4import pipes::send;
 5
 6fn start(c: pipes::chan<int>, start: int, number_of_messages: int) {
 7    let mut i: int = 0;
 8    while i < number_of_messages { c.send(start + i); i += 1; }
 9}
10
11fn main() {
12    debug!{"Check that we don't deadlock."};
13    let (ch, p) = pipes::stream();
14    task::try(|| start(ch, 0, 10) );
15    debug!{"Joined task"};
16}