Adding Glib GMainContext support to DBusGlib Bindings

Marcus Nascimento marcus.cps at gmail.com
Fri Mar 11 06:15:03 PST 2011


On Fri, Mar 11, 2011 at 10:37 AM, Simon McVittie <
simon.mcvittie at collabora.co.uk> wrote:

> On Fri, 11 Mar 2011 at 10:24:21 -0300, Marcus Nascimento wrote:
> > I've been having some trouble running dbus glib (server or client) on a
> > GMainContext other than the default one.
>
> Your patch looks reasonable at first glance; if you want to add this
> functionality, please open an 'enhancement'-severity bug on
> freedesktop.org
> to track it (or reuse an existing one if it would fix an existing bug). If
> possible we prefer patches in the format produced by git format-patch, so
> we
> can preserve attribution.
>
> Potentially-relevant bugs include:
>    https://bugs.freedesktop.org/show_bug.cgi?id=23633
>    https://bugs.freedesktop.org/show_bug.cgi?id=35115
>
>
I'll look for that as soon as I have some time available.


> The reason I'm not particularly enthusiastic about merging this is that
> GDBus
> (in GLib >= 2.26) is probably a better choice for new GObject D-Bus code,
> particularly in the presence of threads. dbus-glib has various design flaws
> and, in practice, mostly isn't thread-safe.
>
> If you're doing this for multi-threading support, please look at the list
> of
> dbus/dbus-glib bugs that mention threads and consider whether you really
> want
> to be doing that, and are able to debug the results...
>
>
That worries me out!
I'm designing a portable lib for embedded (and non-embedded) use.
It has 2 dbus clients receiving signals from 2 dbus servers.
I'm facing a lot of thread issues with glib-dbus.

The major one: I can't start the default GMainLoop inside the library. It
will cause a lot of trouble for apps using GMainLoop by themselves.
For instance: Using my lib with QT will cause some strange events to pop-up.

I tried to create a separate GMainContext to keep things contained and
separate from the rest of the world.
That requires that I create a separate GMainLoop and run it in it's own
thread.
However this loop won't dispatch events unless the default GMainLoop in
running too (and them I face the same problem described in the last
paragraph).

Long story short: Do you recommend moving on from glib-dbus to GDbus in this
case?

Thanks very much for your answer.


Thanks,
>    S
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
>



-- 
--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
Marcus Vinícius do Nascimento
Engenharia de Computação - EC03 - UNICAMP
--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20110311/67110076/attachment.html>


More information about the dbus mailing list