(self)
| 19 | |
| 20 | class AsyncBridge: |
| 21 | def __init__(self): |
| 22 | self._loop = asyncio.new_event_loop() |
| 23 | self._thread = threading.Thread(target=self._loop.run_forever, daemon=True) |
| 24 | self._thread.start() |
| 25 | |
| 26 | def run[T](self, coro: Coroutine[Any, Any, T]) -> T: |
| 27 | return asyncio.run_coroutine_threadsafe(coro, self._loop).result() |