File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ # -*- coding: utf-8 -*-
3+
4+ import threading
5+ import asyncio
6+
7+ async def hello ():
8+ print ('Hello world! (%s)' % threading .currentThread ())
9+ await asyncio .sleep (1 )
10+ print ('Hello again! (%s)' % threading .currentThread ())
11+
12+ loop = asyncio .get_event_loop ()
13+ tasks = [hello (), hello ()]
14+ loop .run_until_complete (asyncio .wait (tasks ))
15+ loop .close ()
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ # -*- coding: utf-8 -*-
3+
4+ import threading
5+ import asyncio
6+
7+ async def hello ():
8+ print ('Hello world! (%s)' % threading .currentThread ())
9+ await asyncio .sleep (1 )
10+ print ('Hello again! (%s)' % threading .currentThread ())
11+
12+ loop = asyncio .get_event_loop ()
13+ tasks = [hello (), hello ()]
14+ loop .run_until_complete (asyncio .wait (tasks ))
15+ loop .close ()
You can’t perform that action at this time.
0 commit comments