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;
|
2011-08-12 19:36:52 -05:00
|
|
|
import std::comm::send;
|
2010-08-24 23:06:56 -05:00
|
|
|
|
2011-10-20 22:34:04 -05:00
|
|
|
fn start(&&args: (comm::chan<int>, int, int)) {
|
2011-10-13 17:37:07 -05:00
|
|
|
let (c, start, number_of_messages) = args;
|
2011-07-27 07:19:39 -05:00
|
|
|
let i: int = 0;
|
2011-08-12 19:36:52 -05:00
|
|
|
while i < number_of_messages { send(c, 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-10-13 17:37:07 -05:00
|
|
|
let p = comm::port::<int>();
|
2011-10-13 23:23:07 -05:00
|
|
|
let a = task::spawn_joinable((comm::chan(p), 0, 10), start);
|
2011-08-25 13:20:43 -05:00
|
|
|
task::join(a);
|
2011-05-12 10:24:54 -05:00
|
|
|
log "Joined task";
|
2011-08-12 19:36:52 -05:00
|
|
|
}
|