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

19 lines
433 B
Rust
Raw Normal View History

use std;
import task;
import comm;
import comm::send;
2011-10-20 20:34:04 -07:00
fn start(&&args: (comm::chan<int>, int, int)) {
let (c, start, number_of_messages) = args;
2011-07-27 14:19:39 +02:00
let 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() {
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";
2011-08-12 17:36:52 -07:00
}