Simple threads...

This commit is contained in:
Kolan Sh 2015-08-19 12:51:35 +03:00
parent fb277d105c
commit 0361cfc4d9
4 changed files with 29 additions and 3 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
valac --thread threads.vala
valac --thread --target-glib=2.32 threads.vala
valac --thread --target-glib=2.32 threads-2.32.vala
valac --thread philosophers.vala
valac --thread async-queue-test.vala

View File

@ -42,5 +42,3 @@ int main () {
return 0;
}

19
vala/threads/class.vala Normal file
View File

@ -0,0 +1,19 @@
public class MyThread {
private string _s;
public MyThread (string s) {
_s = s;
}
public int run () {
stdout.printf ("%s\n", _s);
return 0;
}
}
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 ();
}

View File

@ -0,0 +1,9 @@
int thread_func () {
stdout.puts ("Thread is running!\n");
return 0;
}
void main () {
var t = new Thread.try<int> ("My thread Debugging name...", thread_func);
t.join ();
}