blob: ce4d5dcf21ac2a1cefc1aa201168bd03e8cfcea1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
use std;
import comm::chan;
import comm::send;
fn main() { test05(); }
fn test05_start(&&f: fn~(int)) {
f(22);
}
fn test05() {
let three = ~3;
let fn_to_send = fn~(n: int) {
log(error, *three + n); // will copy x into the closure
assert(*three == 3);
};
task::spawn(fn~[move fn_to_send]() {
test05_start(fn_to_send);
});
}
|