2010-08-24 23:06:56 -05:00
|
|
|
use std;
|
2011-07-12 17:27:17 -05:00
|
|
|
import std::task;
|
2011-08-06 12:07:39 -05:00
|
|
|
import std::comm;
|
2010-08-24 23:06:56 -05:00
|
|
|
|
2011-08-06 12:07:39 -05:00
|
|
|
fn start(pc: *u8, start: int, number_of_messages: int) {
|
|
|
|
let c = comm::chan_from_unsafe_ptr(pc);
|
2011-07-27 07:19:39 -05:00
|
|
|
let i: int = 0;
|
2011-08-06 12:07:39 -05:00
|
|
|
while i < number_of_messages { c.send(start + i); i += 1; }
|
2010-08-24 23:06:56 -05:00
|
|
|
}
|
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
fn main() {
|
2010-08-24 23:06:56 -05:00
|
|
|
log "Check that we don't deadlock.";
|
2011-08-06 12:07:39 -05:00
|
|
|
let p : comm::_port[int] = comm::mk_port();
|
|
|
|
let a: task = spawn start(p.mk_chan().unsafe_ptr(), 0, 10);
|
2011-07-12 17:27:17 -05:00
|
|
|
task::join(a);
|
2011-05-12 10:24:54 -05:00
|
|
|
log "Joined task";
|
2010-08-24 23:06:56 -05:00
|
|
|
}
|