#NEWLINE# def start_with_callback( self , func , args = None , kwargs = None ) : #NEWLINE# #INDENT# "Start 'func' in a new thread T, then start self (and return T)." #NEWLINE# if ( args is None ) : #NEWLINE# #INDENT# args = ( ) #NEWLINE# #UNINDENT# if ( func is None ) : #NEWLINE# #INDENT# kwargs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# args = ( ( func , ) + args ) #NEWLINE# def _callback( func , * a , **kw ) : #NEWLINE# #INDENT# self . wait ( states . STARTED ) #NEWLINE# func ( * a , ** kw ) #NEWLINE# #UNINDENT# t = threading . Thread ( target = _callback , args = args , kwargs = kwargs ) #NEWLINE# t . setName ( ( 'Bus Callback ' + t . getName ( ) ) ) #NEWLINE# t . start ( ) #NEWLINE# self . start ( ) #NEWLINE# return t