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

18 lines
433 B
Rust
Raw Normal View History

use std;
import std::task;
import std::comm;
2011-08-12 17:36:52 -07:00
import std::comm::send;
2011-08-12 17:36:52 -07:00
fn start(c: comm::_chan[int], start: int, number_of_messages: int) {
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] = comm::mk_port();
2011-08-12 17:36:52 -07:00
let a = task::_spawn(bind start(p.mk_chan(), 0, 10));
task::join_id(a);
log "Joined task";
2011-08-12 17:36:52 -07:00
}