threadpool.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:python-application 作者: AGProjects 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号