You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A schedule point is half of a full :ref:`checkpoint`, which allows the async backend to switch the running task, but doesn't check for cancellation (the other half is a :ref:`cancel_point`).
125
+
While you are unlikely to need one, they are available as :func:`trio.lowlevel.cancel_shielded_checkpoint`/:func:`anyio.lowlevel.cancel_shielded_checkpoint`, and equivalent to
126
+
127
+
.. code-block:: python
128
+
129
+
from trio import CancelScope, lowlevel
130
+
# or
131
+
# from anyio import CancelScope, lowlevel
132
+
133
+
with CancelScope(shield=True):
134
+
await lowlevel.checkpoint()
135
+
136
+
asyncio does not have any direct equivalents due to their cancellation model being different.
137
+
138
+
139
+
.. _cancel_point:
140
+
.. _cancel_points:
141
+
142
+
Cancel Point
143
+
------------
144
+
A schedule point is half of a full :ref:`checkpoint`, which will raise :ref:`cancelled` if the enclosing cancel scope has been cancelled, but does not allow the scheduler to switch to a different task (the other half is a :ref:`schedule_point`).
145
+
While you are unlikely to need one, they are available as :func:`trio.lowlevel.checkpoint_if_cancelled`/:func:`anyio.lowlevel.checkpoint_if_cancelled`.
146
+
Users of asyncio might want to use :meth:`asyncio.Task.cancelled`.
0 commit comments