dbus-python: Binding names lazily without using follow_name_owner_changes
Neal H. Walfield
neal at walfield.org
Mon Nov 28 07:43:47 PST 2011
At Mon, 28 Nov 2011 10:45:22 +0000,
Simon McVittie wrote:
> On Sat, 26 Nov 2011 at 22:48:21 +0100, Neal H. Walfield wrote:
> > I know about 'follow_name_owner_changes', but I want my module to work
> > even if the program does not use a main loop.
> If so, then what you can do is considerably restricted. There's a reason
> why most GUI frameworks, and several of the more successful D-Bus bindings
> (e.g. QtDBus and GDBus), mandate the use of a particular main loop, either
> in your main thread or in a worker thread.
I'm a bit confused by your "if so". I'll intepret it as meaning "in
the case that a program don't use a main loop". Please correct me if
I have some simple command-line tools that don't use a main loop but
interact with the server. So far, this (the follow_name_owner_changes
feature) is the only limitation I've run into. Are there others that
I should be aware of?
> > The attached code appears to do what I require.
> > class DBusIndirectObject(object):
> This isn't particularly efficient (run dbus-monitor and see how many method
> calls it'll make!), but is about as good as you're going to get without some
> sort of main loop.
If I'm not mistaken, this will only result in additional dbus traffic
when the server disappears (which is relatively infrequent).
If the server does not exit, the traffic should be the same. Or, am I
More information about the dbus