Re: [Vala] How to initializes the D-BUS thread system ?



I have the same issue but related to g_type_init() when running vala code from C.

So I wrote extern void g_type_init(); and then I call it... It's ugly, but works.

On Jun 8, 2010, at 6:48 PM, WU Jun <quark lihdd net> wrote:

A program is multi-threaded and compiled using vala with '--thread' option.

However, the program generated directly by vala will crash soon after it starts.

gdb tells me that the program crashed in dbus_xxxxxx() (randomly)

To resolve this issue, dbus_g_thread_init() or dbus_threads_init_default() should be called.

I use valac to generate C code, than I found all C files have no dbus_g_thread_init(), nor dbus_threads_init_default().

After adding dbus_g_thread_init() or dbus_threads_init_default() in C code and compiling by gcc. The program won't crash again.

So my question is: how to call dbus_g_thread_init() in vala code ? Shouldn't valac do this automatically with '--thread' option ?

I looked dbus-glib-1.vapi, no 'thread' keyword can be found.
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]