Using dbus_connection_send_with_reply() with and without dispatcher

Soh Kam Yung sohkamyung at
Wed Mar 25 23:09:22 PDT 2009

I have encountered an 'interesting' problem.

I am designing a C API that wraps around libdbus.  When the API sends
a request, I generate a d-bus message and wait for the reply.

The problem I am facing is that my API may be used in two types of
applications: one running a d-bus dispatcher (because the app wants to
listen to d-bus signals) and one *not* running a dispatcher (it only
wants to use my API to send request).

After calling dbus_connection_send_with_reply() in my API, what can I
do to ensure that the call returns properly?  Using
dbus_pending_call_block() would cause problems with the dispatcher but
that appears to be the only way to make the API work in a
non-dispatcher situation.

An additional complication is that the dispatcher may be listening to
the d-bus session bus but my api is sending requests to the d-bus
system bus...<sigh>.

Any suggestions or hints?

Soh Kam Yung
my Google Reader Shared links:
my Google Reader Shared SFAS links:

More information about the dbus mailing list