2010-08-24 23:06:56 -05:00
|
|
|
use std;
|
2011-12-13 18:25:51 -06:00
|
|
|
import task;
|
|
|
|
import comm;
|
|
|
|
import 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() {
|
2011-12-22 16:42:52 -06:00
|
|
|
#debug("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-12-22 16:42:52 -06:00
|
|
|
#debug("Joined task");
|
2011-08-12 19:36:52 -05:00
|
|
|
}
|