Created
December 25, 2017 09:00
Revisions
-
Sraw created this gist
Dec 25, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ `asyncio` won't automatically create event loop for sub-thread, so to run async tasks in sub-thread, we need to manually create an event loop first. loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) asyncio.ensure_future(task()) loop.run_forever()