asynchronous Dbus example

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Jun 7 08:35:37 PDT 2013


On 07/06/13 16:15, Ernast Sevo wrote:
>  I am trying to find an example of how to make asynchronous calls in
> DBus

If possible, use GDBus (part of GLib/GIO) and use functions like
g_dbus_proxy_call() and g_dbus_connection_call(), or use QtDBus and
functions like QDBusAbstractInterface::asyncCall(), or use some other
high-level library.

(I personally recommend GDBus, which uses the GAsyncResult pattern for
asynchronous calls; every function in GDBus that doesn't end with _sync
is asynchronous.)

> I thought that I would be able to use
> dbus_connection_send_with_reply but cant find whether this function
> blocks or not?

If you have to use libdbus (the low-level reference implementation of
D-Bus), that function is the correct way to do asynchronous calls.

You will notice that that function is not particularly convenient to
use. The solution is to use a better library than libdbus.

    S



More information about the dbus mailing list