diff options
Diffstat (limited to 'python/experiments/test_async.py')
| -rw-r--r-- | python/experiments/test_async.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/python/experiments/test_async.py b/python/experiments/test_async.py new file mode 100644 index 00000000..8a9fca38 --- /dev/null +++ b/python/experiments/test_async.py @@ -0,0 +1,20 @@ +import asyncio + +async def pomme(): + while True: + await asyncio.sleep(1) + print("pomme") + +async def poire(): + while True: + await asyncio.sleep(5) + print("poire") + +async def main(): + while True: + await pomme() + await poire() + +if __name__ == "__main__": + loop = asyncio.get_event_loop() + loop.run_until_complete(asyncio.gather(pomme(), poire())) |
