Re: Can we use GMainloop at the libdbus based program?

Simon McVittie <simon.mcvittie-ZGY8ohtN/[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Organization Collabora Ltd.
Message-ID <[email protected]>
On 21/01/15 08:09, 최형준 wrote:
> We useully use "dbus_connection_dispatch"  or
> "dbus_connection_setup_with_g_main()"
> funnctions for dbus message processing at the libdbus based codes.
> 
> Are there any ways to use GMainloop for dbus message processing at the
> libdbus based codes?

Yes, and dbus_connection_setup_with_g_main() already does that.
Specifically, it runs all libdbus message processing from the
g_main_context_default() context: so for instance if you use
g_main_loop_new(NULL, ...) and then g_main_loop_run(), libdbus message
processing will occur inside that main loop.

If you can, I recommend using GDBus (part of GIO) instead of libdbus. It
is thread-safe (unlike dbus-glib), knows how to use non-default main
contexts (e.g. for threaded applications), and does not rely on the
deprecated and unmaintained dbus-glib library.

    S

_______________________________________________
dbus mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dbus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.