Query on operation of dbus_connection_dispatch() and method call
Soh Kam Yung
sohkamyung at gmail.com
Tue Mar 24 18:50:17 PDT 2009
On Tue, Mar 24, 2009 at 12:48 PM, Havoc Pennington
<havoc.pennington at gmail.com> wrote:
> [...]
> Some caveats:
>
> * there are various issues with the thread support in dbus. You might
> consider using DBusConnection from just one thread; have your thread
> return the reply message to your main loop thread, and then only use
> the connection from the main thread.
>
> (Though, I think if someone really just sat down and figured out the
> thread issues, they probably aren't that big of a deal to fix.
> http://bugs.freedesktop.org/show_bug.cgi?id=857 and other bugs
> document some of them.)
> (Also, a nonblocking dbus_connection_send() from another thread may
> well work fine.)
>
> * the caller or the dbus-daemon may time out the method call
> eventually. The dbus-daemon config file can change the daemon timeout.
> The caller can specify a timeout when it sends the call.
>
> Havoc
>
Thanks for the reply.
Regarding the statement: "a nonblocking dbus_connection_send() from
another thread may well work fine". Does this mean that if I want to
send and wait for a reply in a thread, I cannot use
dbus_connection_send_with_reply_and_block()? It is because of
interaction with the d-bus dispatcher in my mainloop?
Would this also apply to dbus_pending_call_block()?
One solution I can think of is to use dbus_pending_call_set_notify()
and use the DBusPendingCallNotifyFunction to send a signal/raise a
semaphore in my thread to process to reply. Is this workable or are
there better ways?
Regards,
Kam-Yung
--
Soh Kam Yung
my Google Reader Shared links:
(http://www.google.com/reader/shared/16851815156817689753)
my Google Reader Shared SFAS links:
(http://www.google.com/reader/shared/user/16851815156817689753/label/sfas)
More information about the dbus
mailing list