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

18 lines
400 B
Rust
Raw Normal View History

use std;
import task;
import comm;
import comm::send;
2012-01-04 21:14:53 -08:00
fn start(c: comm::chan<int>, start: int, number_of_messages: int) {
let mut i: int = 0;
2011-08-12 17:36:52 -07:00
while i < number_of_messages { send(c, start + i); i += 1; }
}
2011-07-27 14:19:39 +02:00
fn main() {
#debug("Check that we don't deadlock.");
let p = comm::port::<int>();
2012-01-04 21:14:53 -08:00
let ch = comm::chan(p);
2012-02-18 16:34:42 -08:00
task::try {|| start(ch, 0, 10) };
#debug("Joined task");
2011-08-12 17:36:52 -07:00
}