Skype and DBus: should my client library act as a server?
simon.mcvittie at collabora.co.uk
Wed Mar 18 13:33:57 PDT 2015
On 18/03/15 20:00, Julien JPK wrote:
> - Start sending my requests from another thread.
Threads! You had a problem, you solved it with threads, and now you have
two problems working in parallel :-)
GDBus has a much better design for threaded use; I strongly recommend it
(and fixed some of its previous threading bugs myself). libdbus is in
theory designed to be thread-safe, but we're not quite sure whether it
actually is; I suspect the answer is "it depends how you use it".
A lot of the pain you have to go through when using libdbus is because
it bends over backwards to avoid depending on any particular event-loop
implementation (GLib, Qt, libevent, etc.) - GDBus can be much simpler
because its asynchronous API is "use the GMainContext abstraction that
GLib already has".
> However, it seemed to me like GLib was overkill for what I
> was trying to achieve at the moment (it is, after all, a huge library...).
GLib is a somewhat large library because "make C non-horrible for
application development" is a significant task, and "make C non-horrible
for application development, in a portable way" doubly so.
libdbus suffers greatly from having to have its own
a-bit-like-GLib-but-not-as-good "make C non-horrible" layer. If you are
not under constraints similar to dbus-daemon, I recommend avoiding libdbus.
Collabora Ltd. <http://www.collabora.com/>
More information about the dbus