summary refs log tree commit diff
path: root/src/test/run-pass/task-comm-13.rs
blob: 3ded4aac5ae9af16c1faabb1c389d75fc6866571 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std;
import task;
import comm;
import comm::send;

fn start(c: comm::chan<int>, start: int, number_of_messages: int) {
    let mut i: int = 0;
    while i < number_of_messages { send(c, start + i); i += 1; }
}

fn main() {
    #debug("Check that we don't deadlock.");
    let p = comm::port::<int>();
    let ch = comm::chan(p);
    task::try(|| start(ch, 0, 10) );
    #debug("Joined task");
}