Asyncio event loop per python process (aioprocessing, multiple event loops)

前端 未结 1 1677
后悔当初
后悔当初 2021-02-02 01:38

I have two processes; a main process and a subprocess. The main process is running an asyncio event loop, and starts the subprocess. I want to start another asyncio

相关标签:
1条回答
  • 2021-02-02 02:16

    Sorry for disturb! I found a solution!

    policy = asyncio.get_event_loop_policy()
    policy.set_event_loop(policy.new_event_loop())
    loop = asyncio.get_event_loop()
    

    put this code to start new asycnio event loop inside of subprocess started from process with asyncio event loop

    0 讨论(0)
提交回复
热议问题