Looks like I spoke too soon. The attached program emits a wrong output:
** Message: thread.vala:43: main thread 14350
** Message: thread.vala:31: thread 14352
** Message: thread.vala:21: thread 14351
** Message: thread.vala:31: thread 14352
** Message: thread.vala:21: thread 14352
** Message: thread.vala:31: thread 14352
** Message: thread.vala:21: thread 14352
** Message: thread.vala:43: main thread 14350
** Message: thread.vala:31: thread 14352
** Message: thread.vala:21: thread 14352
--
:M:
void* thread_func_1()
{
var loop = new MainLoop();
async_func_1();
loop.run();
return null;
}
void* thread_func_2()
{
var loop = new MainLoop();
async_func_2();
loop.run();
return null;
}
async void async_func_1()
{
while ( true )
{
message( "thread %d", (int)Linux.gettid() );
Timeout.add_seconds( 1, async_func_1.callback );
yield;
}
}
async void async_func_2()
{
while ( true )
{
message( "thread %d", (int)Linux.gettid() );
Timeout.add_seconds( 1, async_func_2.callback );
yield;
}
}
void main()
{
Thread.create( thread_func_1, false );
Thread.create( thread_func_2, false );
while ( true )
{
message( "main thread %d", (int)Linux.gettid() );
Thread.usleep( 1000 * 1000 * 2 );
}
}
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list