Private connections

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Feb 22 04:16:42 PST 2007


On Thu, 22 Feb 2007 at 08:51:51 +0100, Thiago Macieira wrote:
> I didn't understand: do you also consider it a bug if the bindings require 
> a private connection?
> 
> AFAIK, all of the major bindings do that, for various reasons.

I'm not sure about dbus-glib, it might be close enough to libdbus'
semantics to get away with using shared connections.

dbus-python (0.80)'s reason not to is reference count correctness. With our
current implementation (everything private at the libdbus level, shared
connections implemented at the Python level) it's simple to have the
DBusPyConnection (a PyObject) reference the DBusConnection (a libdbus
object), guaranteeing the DBusPyConnection has a longer lifetime than
the DBusConnection, so the DBusConnection only needs a weak reference to
the DBusPyConnection.

If we used shared connections, we'd either have inter-object-model reference
cycles (making the shared connection immortal, even when closed and hence
unshared) or DBusPyConnections with shorter lifespans than their
DBusConnection (likely making signal handlers fall off at arbitrary times).
I believe the shared connections in < 0.80 are immortal.

It took me about a week of "ooh, what if I did... no, that won't work"
to come up with the current design, so I'm reasonably confident that
it's the least bad...

	Simon


More information about the dbus mailing list