MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _cancel_and_wait

Function _cancel_and_wait

tools/python-3.11.9-amd64/Lib/asyncio/tasks.py:551–564  ·  view source on GitHub ↗

Cancel the *fut* future or task and wait until it completes.

(fut, loop)

Source from the content-addressed store, hash-verified

549
550
551async def _cancel_and_wait(fut, loop):
552 """Cancel the *fut* future or task and wait until it completes."""
553
554 waiter = loop.create_future()
555 cb = functools.partial(_release_waiter, waiter)
556 fut.add_done_callback(cb)
557
558 try:
559 fut.cancel()
560 # We cannot wait on *fut* directly to make
561 # sure _cancel_and_wait itself is reliably cancellable.
562 await waiter
563 finally:
564 fut.remove_done_callback(cb)
565
566
567# This is *not* a @coroutine! It is just an iterator (yielding Futures).

Callers 1

wait_forFunction · 0.85

Calls 5

partialMethod · 0.80
remove_done_callbackMethod · 0.80
create_futureMethod · 0.45
add_done_callbackMethod · 0.45
cancelMethod · 0.45

Tested by

no test coverage detected