]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/task-comm-13.rs
port over the tests to use the new API
[rust.git] / src / test / run-pass / task-comm-13.rs
1 use std;
2 import task;
3 import comm;
4 import comm::send;
5
6 fn start(c: comm::chan<int>, start: int, number_of_messages: int) {
7     let i: int = 0;
8     while i < number_of_messages { send(c, start + i); i += 1; }
9 }
10
11 fn main() {
12     #debug("Check that we don't deadlock.");
13     let p = comm::port::<int>();
14     let ch = comm::chan(p);
15     let a = task::spawn_joinable {|| start(ch, 0, 10); };
16     task::join(a);
17     #debug("Joined task");
18 }