Starting the kdbus discussions
David Zeuthen
zeuthen at gmail.com
Fri Jan 17 11:51:19 PST 2014
Hi,
On Fri, Jan 17, 2014 at 11:33 AM, Lennart Poettering <mzqohf at 0pointer.de> wrote:
> Well, libdbus1 covers both usecases too, no?
Well, libdbus-1 tried to be thread-safe but it never really worked. In
fact, I initially based GDBus on libdbus-1 but then it started
breaking very horribly when I added complex test-cases as the one
described below. (I think libdbus-1 is a little better nowadays in
this regard but AFAICT it cannot ever be made to work - Simon knows
more than I about this.)
> What does the worker thread
> bring as a benefit over the way libdbus1 handles this?
The ability to have multiple threads doing both sync and async calls
and have this work without these interfering with each other (for
example, a blocking call in one thread should not prevent delivery of
D-Bus messages in other threads). In the case of async calls, each
thread then run its own mainloop. See
https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-threading.c?id=2.39.3#n340
for details. If you want your D-Bus library to do this kind of thing -
and in GLib we really do - the straightforward way to do this involves
a worker-thread. In fact, I'm not even sure exactly how to do this
without a worker-thread but I didn't think very hard about it because,
hey, the correct way to use D-Bus back then (and even today, though
you guys are changing things) is few messages with small payloads (and
passing file-descriptors around for bulk I/O, for example
udisks/gnome-disks disk image copy/restore does this).
That said, the API and semantics of GDBus does not depend on the
worker thread, it's (mostly, with some exceptions) an implementation
detail. So if someone were to figure out how to do all this without a
worker thread (using new kdbus kernel primitives) and it makes tests
pass and it looks maintainable, then, hey, I'm sure I or others would
be happy to review it and land it. I mean, it's not like I hate
performance or anything, it's just, meh, while it's cool, it's totally
not relevant for how people have _historically_ at least used D-Bus.
David
More information about the dbus
mailing list