blob: dc2393d13f481b055fdaefcaed73916ef09c3d06 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
use std;
import task;
import comm;
import comm::send;
fn start(c: comm::chan<int>, start: int, number_of_messages: int) {
let i: int = 0;
while i < number_of_messages { send(c, start + i); i += 1; }
}
fn main() {
#debug("Check that we don't deadlock.");
let p = comm::port::<int>();
let ch = comm::chan(p);
let a = task::spawn_joinable {|| start(ch, 0, 10); };
task::join(a);
#debug("Joined task");
}
|