async_utils.py 文件源码

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

项目:pyrpl 作者: lneuhaus 项目源码 文件源码
def await_result(self, timeout=None):
        """
        Return the result of the call that the future represents.
        Will not return until either timeout expires or future becomes "done".

        There is one potential deadlock situation here:
        The deadlock occurs if we await_result while at the same
        time, this future needs to await_result from another future since
        the eventloop will be blocked.
        ---> To be safe, don't use await_result() in a Qt slot. You should
        rather use result() and add_done_callback() instead.

        Args:
            timeout: The number of seconds to wait for the result if the future
                isn't done. If None, then there is no limit on the wait time.

        Returns:
            The result of the call that the future represents.

        Raises:
            CancelledError: If the future was cancelled.
            TimeoutError: If the future didn't finish executing before the
                          given timeout.
            Exception: If the call raised then that exception will be raised.
        """

        self._wait_for_done(timeout)
        return self.result()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号