utils.py 文件源码

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

项目:KodiDevKit 作者: phil65 项目源码 文件源码
def check_busy(func):
    """
    Decorator to check for self.is_busy
    Only one of the decorated functions may run simultaniously
    """

    @wraps(func)
    def decorator(self, *args, **kwargs):
        if self.is_busy:
            logging.critical("Already busy. Please wait.")
            return None
        self.is_busy = True
        try:
            func(self, *args, **kwargs)
        except Exception as e:
            logging.critical(e)
        self.is_busy = False
    return decorator
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号