Re: Running dbus_connection_read_write_dispatch in a separate thread

Simon McVittie <smcv-ZGY8ohtN/[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Message-ID <20200618165114.GA649722@horizon>
On Thu, 18 Jun 2020 at 19:29:25 +0300, Alexandru Sorodoc wrote:
> How do I get a file descriptor?

Use dbus_connection_set_watch_functions() to ask the connection to tell
you about its file descriptor(s) and the event(s) it wants you to poll for.
You will likely also need dbus_connection_set_timeout_functions(),
dbus_connection_set_wakeup_main_function() and
dbus_connection_set_dispatch_status_function().

https://gitlab.freedesktop.org/dbus/dbus-glib/-/blob/dbus-gmain/dbus-gmain.c
is a complete example of everything that's needed, although using GLib's
main loop abstraction rather than doing its own polling.

I hope you saw the documentation's warning that "If you use this low-level
API directly, you're signing up for some pain".

Good luck,
    smcv
_______________________________________________
dbus mailing list
[email protected]
https://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.