1 parent dc7a167 commit ba8b995Copy full SHA for ba8b995
1 file changed
py3/async/async_wget.py
@@ -1,11 +1,13 @@
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
4
+import threading
5
import asyncio
6
7
@asyncio.coroutine
8
def wget(host):
9
print('wget %s...' % host)
10
+ print('current thread: %s' % threading.current_thread())
11
connect = asyncio.open_connection(host, 80)
12
reader, writer = yield from connect
13
header = 'GET / HTTP/1.0\r\nHost: %s\r\n\r\n' % host
@@ -24,3 +26,4 @@ def wget(host):
24
26
for task in tasks:
25
27
loop.run_until_complete(task)
28
loop.close()
29
+print('main thread: %s' % threading.current_thread())
0 commit comments