Skip to content
Snippets Groups Projects
Commit 896b2391 authored by jkerdreu's avatar jkerdreu
Browse files

Drop


git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@2918 b32b6428-25c9-4566-ad07-03861ab6144f
parent b95ee6d7
No related branches found
No related tags found
No related merge requests found
import asyncio
import logging
import signal
logging.basicConfig(level=logging.DEBUG,)
ev = asyncio.Event()
async def test1():
while not ev.is_set():
print('test1')
await asyncio.sleep(1)
async def test2():
print('test2')
await ev.wait()
print('Byebye')
def kill(signal,frame):
global ev
print('Killed')
ev.set()
async def main():
t1 = asyncio.create_task(test1())
t2 = asyncio.create_task(test2())
await t1
await t2
try:
signal.signal(signal.SIGINT, kill)
asyncio.run(main())
except KeyboardInterrupt:
print('Byebye')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment