Closed
Description
PR #188 added some initial support for an curio-asyncio bridge. I've extended it with a different approach in which you can create a Curio stand-in for the asyncio event loop and submit coroutines to it. Like this::
from curio.bridge import AsyncioLoop
import asyncio
loop = AsyncioLoop()
# an asyncio coroutine - not curio
async def aio_coro(x, y):
await asyncio.sleep(2)
return x + y
# A curio coroutine - not asyncio
async def main():
result = await loop.run_until_complete(aio_coro(2, 2))
print(result)
run(main())
Under the covers, asyncio is running the event loop in a different thread. The event loop gets shut down automatically when the Curio kernel gets shutdown.
This issue is further discussion about this. What should curio-asyncio bridging look like in a ideal world?
Metadata
Metadata
Assignees
Labels
No labels