Hi folks,<br><br>I have an application which has two threads. One
thread receives requests and as a result makes d-bus method calls to a
server. The other thread is a glib MainLoop which listens for signals
coming in from the server (and may as a consequent make further d-bus
method calls).<br>
<br>Intermittently I am getting mysterious crashes which seem to be
coming from dbus. Sometimes the application can run for a couple of
hours before this happens.<br><br>Are there any guidelines to follow when using d-bus from multiple threads? I feel like I'm working somewhat in the dark!<br>
<br>My latest attempt to fix this is to change the application to use a separate private connection for each thread by doing this:<br><br>conn1 = dbus_g_bus_get_private(DBUS_<div id=":gs">BUS_SESSION, NULL, &error);<br>
conn2 = dbus_g_bus_get_private(DBUS_BUS_SESSION, NULL, &error);<br>
<br>Each thread only ever uses proxies created on it's connection.<br><br>I am also calling the following (which I presume are required if using the library from threads):<br><br> g_thread_init(NULL);<br> dbus_g_thread_init_default();<br>
<br>The main loop is started as follows:<br><br> main_loop = g_main_loop_new(NULL, TRUE);<br><br>Does this seem like a reasonable approach?<br><br>It
would be great to understand the limitations of using d-bus from
threads... The version of libdbus-glib I'm using is 2.1.0 and libdbus
is 3.4.0.<br>
<br>Regards,<br><font color="#888888">Ivan</font></div>