摘要:
from threading import Thread,Lock import time mutex=Lock() n=100 def task(): global n temp=n time.sleep(0.1) n=temp-1 if __name__ == '__main__': l=[] 阅读全文
摘要:
import time def func1(): for i in range(10000000): i+1 def func2(): for i in range(10000000): i+1 start = time.time() func1() func2() stop = time.time 阅读全文
摘要:
from gevent import monkey;monkey.patch_all() from socket import * from gevent import spawn #导入spawn之前一定要传入monkey #俩个io密集型任务 def comun(conn): while Tru 阅读全文