new to python dbus and a tad confused..

Samantha Atkins sjatkins at gmail.com
Thu Dec 8 13:37:38 PST 2011


Especially I am confused by the loop and how to set it up in a way so that
I don't have to have more or less a dedicated process per Interface vended.
 For instance I have a process now that handles quite a bit with five or so
threading.Threads of its own.  It currently exports some methods using
multi-threaded XMLRPC server.  I would like to export those using
dbus.Object instead but without messing up my other threads.  I would also
like to replace a thread listening on a datagram socket with dbus client in
same process to that other process that both sends messages and responds to
signals from said other process (another dbus loop usage).   I tried
subclassing the main class and playing with gobject.init_threads and
gobject's loop context to do iteration in a separate thread.  I set up the
other loop, via dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) as
well as per many samples.  I still get complaints that dbus doesn't know
what the default loop is.  This is rather confusing.

It is very odd that you have to make one call that actually produces a
dbus.mainloop.NativeMainLoop then make another call that produces a
glib.MainLoop. It is enough to make one quite loopy. :)

So what the heck is all of this for? Then to add to fun I have to do
gobject.init_threads() just to keep everything from locking up (other
threading threads especially) apparently. More opaque and unexplained
mystery. And to top that off I see there is another possible threading
initialization in the mix, dbus.glib.threads_init. I find several different
variants online, none of which seem to quite work for my situation.

What I want to do and want the simplest path to accomplishing: Expose
multiple dbus objects and interfaces from a process that is already doing
multiple things. I don't want and cannot live with one process per
Interface implementation as many examples show. This needs to be perfectly
content with any other threading.Thread stuff in the process. I would like
to end up with the minimal number of new threads to handle dbus loop stuff.
Ideally I would love to wrap this up about as simply as starting an
XMLRPCService. What do I need? Note, I am in an embedded debian environment
and I am not running Qt.

Any help or a clear example that I am not likely to have already found
after many hours of google searching would be very much appreciated.

Thanks for your time.

- samantha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20111208/68f7555d/attachment.html>


More information about the dbus mailing list