_run.py 文件源码

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

项目:trio 作者: python-trio 项目源码 文件源码
def checkpoint():
    """A pure :ref:`checkpoint <checkpoints>`.

    This checks for cancellation and allows other tasks to be scheduled,
    without otherwise blocking.

    Note that the scheduler has the option of ignoring this and continuing to
    run the current task if it decides this is appropriate (e.g. for increased
    efficiency).

    Equivalent to ``await trio.sleep(0)`` (which is implemented by calling
    :func:`checkpoint`.)

    """
    with open_cancel_scope(deadline=-inf) as scope:
        await _core.wait_task_rescheduled(lambda _: _core.Abort.SUCCEEDED)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号