async.py 文件源码

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

项目:threadless 作者: poolpOrg 项目源码 文件源码
def run(self):
        threadless.log.debug("threadlet: %s: tasklet(%s): running", self.threadlet.name, self.name)
        self.running = True

        try:
            value = self.func(self)
            if isinstance(value, types.GeneratorType):
                value = yield from value
            threadless.log.debug("threadlet: %s: tasklet(%s): done", self.threadlet.name, self.name)
        except asyncio.CancelledError:
            threadless.log.warn("threadlet: %s: tasklet(%s): cancelled", self.threadlet.name, self.name)
        except Exception:
            threadless.log.exception("threadlet: %s: tasklet(%s): exception", self.threadlet.name, self.name)

        del self.running
        if self.suspended or self.cancelled:
            return
        if self.period and self not in self.threadlet.timeouts:
            self.schedule(self.period)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号