#NEWLINE# def _coordinateThisTask( self , task ) : #NEWLINE# #INDENT# '\n        Select a worker to dispatch to, either an idle one or a new one, and\n        perform it.\n\n        This method should run on the coordinator worker.\n\n        @param task: the task to dispatch\n        @type task: 0-argument callable\n        ' #NEWLINE# worker = ( self . _idle . pop ( ) if self . _idle else self . _createWorker ( ) ) #NEWLINE# if ( worker is None ) : #NEWLINE# #INDENT# self . _pending . append ( task ) #NEWLINE# return #NEWLINE# #UNINDENT# self . _busyCount += 1 #NEWLINE# @ worker . do #NEWLINE# def doWork( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# task ( ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# self . _logException ( ) #NEWLINE# #UNINDENT# @ self . _coordinator . do #NEWLINE# def idleAndPending( ) : #NEWLINE# #INDENT# self . _busyCount -= 1 #NEWLINE# self . _recycleWorker ( worker )