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

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

fn main() {
    log "Check that we don't deadlock.";
    let p = comm::port::<int>();
    let a = task::spawn_joinable((comm::chan(p), 0, 10), start);
    task::join(a);
    log "Joined task";
}