gevent监测单线程下的io进行切换

from gevent import monkey;monkey.patch_all()
import gevent
import time

def eat(name):
    print('%s eat 1' % name)
    time.sleep(3)
    print('%s eat 2' % name)

def play(name):
    print('%s play 1' % name)
    time.sleep(4)
    print('%s play 2' % name)

g1=gevent.spawn(eat,'egon')
g2=gevent.spawn(play,'alex')

# time.sleep(5)

# g1.join()
# g2.join()

gevent.joinall([g1,g2])
上一篇:pudn下载地址的规律


下一篇:【android】在eclipse中查看genymotion模拟器的sd卡文件夹