'Tell num_workers worker threads to quit after their current task.'

def dismissWorkers(self, num_workers):

    for i in range(min(num_workers, len(self.workers))):
        worker = self.workers.pop()
        worker.dismiss()
