Skip to content

Instantly share code, notes, and snippets.

@nitely nitely/async_fifo.py
Last active Feb 11, 2018

Embed
What would you like to do?
asyncio FIFO
import asyncio
async def testProc():
for i in range(10):
await asyncio.sleep(1)
print("sleep")
def callbackProc():
#print("Callback event")
loop = asyncio.get_event_loop()
loop.call_soon(callbackProc)
if __name__ == '__main__':
loop = asyncio.get_event_loop()
try:
print('task creation started')
asyncio.ensure_future(testProc())
loop.call_soon(callbackProc)
loop.run_forever()
finally:
loop.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.