Skip to content

Commit 114345a

Browse files
committed
gevent
1 parent 4d5c236 commit 114345a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

gevent_example.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
import gevent
3+
from gevent import socket
4+
hosts = ['www.crappytaxidermy.com', 'www.sina.com.cn','www.sohu.com']
5+
jobs = [gevent.spawn(gevent.socket.gethostbyname, host) for host in hosts]
6+
gevent.joinall(jobs, timeout=5)
7+
for job in jobs:
8+
print(job.value)

0 commit comments

Comments
 (0)