def _coro_runner(self):
while True:
# Wait for a hand-off
await disable_cancellation(_future_wait(self._request))
self._coro = self._request.result()
self._request = Future()
# If no coroutine, we're shutting down
if not self._coro:
break
# Run the the coroutine
try:
self._result_value = await self._coro
self._result_exc = None
except BaseException as e:
self._result_value = None
self._result_exc = e
# Hand it back to the thread
self._done_evt.set()
await self._terminate_evt.set()
评论列表
文章目录