mercurial/worker.py
changeset 37844 8fb9985382be
parent 36835 5bc7ff103081
child 38535 8c38d2948217
equal deleted inserted replaced
37843:670eb4fa1b86 37844:8fb9985382be
   233                             # threading doesn't provide a native way to
   233                             # threading doesn't provide a native way to
   234                             # interrupt execution. handle it manually at every
   234                             # interrupt execution. handle it manually at every
   235                             # iteration.
   235                             # iteration.
   236                             if self._interrupted:
   236                             if self._interrupted:
   237                                 return
   237                                 return
   238                     except util.empty:
   238                     except pycompat.queue.Empty:
   239                         break
   239                         break
   240             except Exception as e:
   240             except Exception as e:
   241                 # store the exception such that the main thread can resurface
   241                 # store the exception such that the main thread can resurface
   242                 # it as if the func was running without workers.
   242                 # it as if the func was running without workers.
   243                 self.exception = e
   243                 self.exception = e
   260                 ui.warn(_("failed to kill worker threads while "
   260                 ui.warn(_("failed to kill worker threads while "
   261                           "handling an exception\n"))
   261                           "handling an exception\n"))
   262                 return
   262                 return
   263 
   263 
   264     workers = _numworkers(ui)
   264     workers = _numworkers(ui)
   265     resultqueue = util.queue()
   265     resultqueue = pycompat.queue.Queue()
   266     taskqueue = util.queue()
   266     taskqueue = pycompat.queue.Queue()
   267     # partition work to more pieces than workers to minimize the chance
   267     # partition work to more pieces than workers to minimize the chance
   268     # of uneven distribution of large tasks between the workers
   268     # of uneven distribution of large tasks between the workers
   269     for pargs in partition(args, workers * 20):
   269     for pargs in partition(args, workers * 20):
   270         taskqueue.put(pargs)
   270         taskqueue.put(pargs)
   271     for _i in range(workers):
   271     for _i in range(workers):