Vala: hello.vala

This commit is contained in:
Kolan Sh 2012-10-02 15:15:37 +04:00
parent 1a6b9cdab6
commit d280a6a024
1 changed files with 26 additions and 0 deletions

26
vala/hello/thread.vala Normal file
View File

@ -0,0 +1,26 @@
using GLib;
public class MyThread : GLib.Object
{
public static void * thread_fun()
{
stdout.printf( "Поток активизирован... \n" );
return null;
}
public static int main( string [] args )
{
if( !Thread.supported() )
{
stdout.printf( "Без поддержки потоков выполнение невозможно \n" );
return -1;
}
try
{
Thread.create <void *>( thread_fun, false );
}
catch( ThreadError ex )
{
return -1;
}
return 0;
}
}