import threading import time num=0 def Mylock(lock): global num lock.acquire() num=num+1 time.sleep(1) print num, lock.release() lock=threading.Lock() for item in range(5): t=threading.Thread(target=Mylock,args=(lock,)) t.start() 1 2 3 4 5 #可以去掉lock,…