#NEWLINE# def run( self , funcs ) : #NEWLINE# #INDENT# if self . _workers : #NEWLINE# #INDENT# raise RuntimeError ( ( 'Can not start another `run` with %s existing workers' % len ( self . _workers ) ) ) #NEWLINE# #UNINDENT# self . _queue = compat_queue . Queue ( ) #NEWLINE# self . _death . clear ( ) #NEWLINE# futs = [ ] #NEWLINE# for i in compat_range ( 0 , self . _max_workers ) : #NEWLINE# #INDENT# w = threading . Thread ( target = _chained_worker , args = ( ( i + 1 ) , self . _death , self . _queue , futs ) ) #NEWLINE# w . daemon = True #NEWLINE# w . start ( ) #NEWLINE# self . _workers . append ( w ) #NEWLINE# #UNINDENT# for func in funcs : #NEWLINE# #INDENT# fut = futures . Future ( ) #NEWLINE# futs . append ( fut ) #NEWLINE# self . _queue . put ( ( func , fut ) ) #NEWLINE# #UNINDENT# return futs