threading.py 文件源码

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

项目:Deploy_XXNET_Server 作者: jzp820927 项目源码 文件源码
def wait(self, timeout=None):
        self.__cond.acquire()
        try:
            if not self.__flag:
                self.__cond.wait(timeout)
            return self.__flag
        finally:
            # NOTE(google) Added the try/except. This handles the possibility of
            # an asynchronous exception (e.g., DeadlineExceededError) being
            # thrown inside of Condition.wait such that it does not re-acquire
            # the lock, causing a ThreadError 'release unlocked lock' to be
            # raised by Condition.release.
            # It is safe to ignore such an error, because it means the lock is
            # already released.
            try:
                self.__cond.release()
            except ThreadError:
                pass

# Helper to generate new thread names
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号