Re: [Vala] Threads and closures problem
- From: JM <interflug1 gmx net>
- To: vala-list <vala-list gnome org>
- Subject: Re: [Vala] Threads and closures problem
- Date: Thu, 14 Jan 2010 01:53:00 +0100
If I do the same thing with an Idle, the behavior is significantly
different, as the block data is not destroyed as soon as the run()
function is left. Why is that?
Well working example:
class HHH : Object {
public void run() {
string test = "test";
Idle.add(() => { print("in idle : %s \n", test); return false;});
}
public static MainLoop loop;
public static int main() {
loop = new MainLoop(null, false);
var h = new HHH();
h.run();
h.run();
h.run();
h.run();
loop.run();
return 0;
}
}
// valac closuretest.vala
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]