Detectin mainloop integration

Havoc Pennington hp at redhat.com
Thu Sep 20 06:43:00 PDT 2007


Hi,

On 9/20/07, Alexander Larsson <alexl at redhat.com> wrote:
> In gvfs I'm using my own glib mainloop integration code (for various
> reasons). This is a problem if the application using gvfs has used some
> other form of mainloop integration (for instance the dbus-glib one). Is
> there some way to detect that someone called e.g.
> dbus_connection_set_watch_functions() before so that I can avoid doing
> the integration myself?
>
> Or should I just use a private connection?
>

I posted some vague idea of a possible API here a while back (the idea
was to be able to set a named 'framework' like GLib, Qt and to be able
to assert that you were either 1) willing to silently fail since you
really wanted "a" main loop integration not yours specifically, or
that 2) the app should abort if a differently-named framework was
already set, since you really did specifically require your
framework).

In this case you are expecting to be used in a GNOME process, right?
For the GNOME platform, we need to say "it is defined and known that
the main loop integration is XYZ" or *at minimum* "it is defined and
known that the object system mapping(s) GNOME apps use are compatible
with all main loop integrations that might be in use"

(think of dbus-glib as a main loop integration + an object system
mapping, but those two are really separable, e.g. hippo-dbus-helper.c
is an alternate object system mapping using the same main loop
integration)

See also
http://lists.freedesktop.org/archives/dbus/2007-August/008236.html
and
http://lists.freedesktop.org/archives/dbus/2007-August/008238.html
and surrounding thread.

Here is how to think of this: in GNOME, we are generally declaring
that GDK owns the X display connection and handles its main loop link.
Both opening a separate X display connection and trying to take over
the X display connection are problematic and somewhat inefficient.
With dbus, the situation is approximately the same, though a separate
private connection is less bad than a private X connection, just
because libdbus is a little more friendly to that than Xlib.

Anyway, if you really need your own integration, you have to either
support whatever a GNOME app would expect, or use a private
connection.

However, it does suck if every GNOME app is making two connections, so
if we can figure out a way to use the shared one that is ideal.

Havoc


More information about the dbus mailing list