Simple threads...
This commit is contained in:
parent
fb277d105c
commit
0361cfc4d9
|
@ -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
|
||||
|
|
|
@ -42,5 +42,3 @@ int main () {
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 ();
|
||||
}
|
|
@ -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 ();
|
||||
}
|
Loading…
Reference in New Issue