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
|
|
|
|
2012-01-04 23:14:53 -06:00
|
|
|
fn start(c: comm::chan<int>, start: int, number_of_messages: int) {
|
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>();
|
2012-01-04 23:14:53 -06:00
|
|
|
let ch = comm::chan(p);
|
2012-02-18 18:34:42 -06:00
|
|
|
task::try {|| start(ch, 0, 10) };
|
2011-12-22 16:42:52 -06:00
|
|
|
#debug("Joined task");
|
2011-08-12 19:36:52 -05:00
|
|
|
}
|