def _worker(self):
thread = current_thread()
while True:
task = self._queue.get()
if task is self.StopWorker:
break
# noinspection PyBroadException
try:
task.function(*task.args, **task.kw)
except:
log.exception('Unhandled exception while calling %r in the %r thread' % (task.function, thread.name))
finally:
with self._lock:
self.__dict__['jobs'] -= 1
del task
self._threads.remove(thread)
评论列表
文章目录