[Vala] How to initializes the D-BUS thread system ?
- From: WU Jun <quark lihdd net>
- To: vala-list gnome org
- Subject: [Vala] How to initializes the D-BUS thread system ?
- Date: Wed, 09 Jun 2010 00:48:51 +0800
A program is multi-threaded and compiled using vala with '--thread' option.
However, the program generated directly by vala will crash soon after it
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.
] [Thread Prev