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

17 lines
365 B
Rust
Raw Normal View History

// xfail-stage0
use std;
import std::task;
2011-07-27 07:19:39 -05:00
fn start(c: chan[int], start: int, number_of_messages: int) {
let i: int = 0;
while i < number_of_messages { c <| start + i; i += 1; }
}
2011-07-27 07:19:39 -05:00
fn main() {
log "Check that we don't deadlock.";
2011-07-27 07:19:39 -05:00
let p: port[int] = port();
let a: task = spawn start(chan(p), 0, 10);
task::join(a);
log "Joined task";
}