Thread Signal

Simon McVittie simon.mcvittie at
Wed Jul 11 10:34:00 PDT 2007

On Tue, 10 Jul 2007 at 15:30:24 +0000, Robert Rawlins wrote:
> What I'd like to do, ideally, is have the signal start a thread, passing its arguments into the init method for the thread as its quite plausible the signal can be sent quite regularly and the resulting process quite slow, so putting them in threads makes it all a little better.
> Any ideas on how to achieve this, can i simply do something like:
> myinterface.connect_to_signal('SignalNake', MyFunction().start())

The callback can be any callable and it can do whatever you like. For
instance, the callback could start a thread:

import thread
def threaded_handler(*args):
def callback(*args):
    thread.start_new_thread(threaded_handler, args)
myinterface.connect_to_signal('SignalName', callback)

or it could call the constructor of a threading.Thread object then call
its start() method, or do anything else you can devise.

More information about the dbus mailing list