Python DBus without gobject main loop

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Jan 11 03:28:51 PST 2007


On Wed, 10 Jan 2007 at 16:44:41 -0600, tsuraan wrote:
> I guess it is possible to run the gobject.MainLoop in a thread and do other
> things, by first calling gobject.threads_init() and then calling
> dbus.glib.init_threads().  Is there a FAQ for the python dbus stuff?  Is
> there even a web page for the python dbus API?

Not for 0.71, as far as I know. It's in progress for 0.80 - API docs at
<http://people.freedesktop.org/~smcv/dbus-python-0.8pre/epydoc/>, and
I'm halfway through writing a tutorial (not in a release yet, see the git
repo).

For how to get the glib main loop running in a thread, you'd have to
refer to python-glib documentation. dbus-python 0.80 is believed to be 
thread-safe, and definitely releases the GIL before starting blocking
operations; I can't make any guarantees about 0.71 (it's written in Pyrex,
so it's probably Pyrex-implementation-dependent whether or when the GIL is
released).

I should probably try adding a threaded test-case at some point to make
sure it's possible. If you come up with one first, patches welcome!

Once I've done a final release of 0.80, one of the next things to add
(perhaps for 0.81) is more versatile main-loop handling; I want to get
all the API changes released first, though.

	Simon


More information about the dbus mailing list