Hi all
I just played around with closures as thread functions. I'm not sure if
this example is supposed to work, but at least it compiles.
class HHH : Object {
public void run() {
string test = "test";
try {
Thread.create( ()=> { print("in thread : %s \n", test);
}, false);
}
catch(GLib.ThreadError e) {
print("%s", e.message);
}
}
public static MainLoop loop;
public static int main() {
loop = new MainLoop(null, false);
var h = new HHH();
h.run();
loop.run();
return 0;
}
}
// valac --thread hhh.vala
Problem is that the value in the closure is lost somehow.
The output of this test program is:
$./hhh
in thread : (null)
Anybody knows how this should be handled?
Regards
Jörn
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list