Updated
On this page
Provides run_sync(), which runs an async coroutine from sync code: asyncio.run() when no loop is running, run_coroutine_threadsafe() when the loop lives on another thread, and a hard RuntimeError from the loop's own thread.
#protocols.src.orxtra.protocols._sync
#protocols.src.orxtra.protocols._sync
#run_sync
python
def run_sync(coro: Coroutine[Any, Any, T]) -> TRun an async coroutine from synchronous code.
Three modes:
- No running event loop: uses asyncio.run()
- Running loop on a different thread: uses run_coroutine_threadsafe()
- Running loop on THIS thread: raises RuntimeError