dev/vala/threads/class.vala

22 lines
378 B
Vala
Raw Normal View History

2015-08-19 14:28:12 +03:00
public class MyThread : Object {
2015-08-19 12:51:35 +03:00
private string _s;
public MyThread (string s) {
_s = s;
}
public int run () {
stdout.printf ("%s\n", _s);
2015-08-19 14:28:12 +03:00
//Thread.usleep(3000000);
2015-08-19 12:51:35 +03:00
return 0;
2015-08-19 14:28:12 +03:00
//Thread.exit (0); // the same
2015-08-19 12:51:35 +03:00
}
}
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 ();
}