dev/vala/threads/class.vala

22 lines
378 B
Vala

public class MyThread : Object {
private string _s;
public MyThread (string s) {
_s = s;
}
public int run () {
stdout.printf ("%s\n", _s);
//Thread.usleep(3000000);
return 0;
//Thread.exit (0); // the same
}
}
void main () {
var mt = new MyThread ("This is my thread is running!\n");
var t = new Thread<int> ("Debugging thread name", mt.run);
t.join ();
}