标签:
线程互斥:实质某一资源同时只允许一个访问者对其进行访问,具有唯一性和排他性。
import threading
import time
g_lock = threading.Lock()
def func():
global tmp
global g_lock
g_lock.acquire()
for i in range(20,40):
tmp = i]
print “%s:tmp = %d”%(threading.currentThread(),getName(),tmp)
time.sleep(1)
g_lock.release()
p.join()
标签:
原文地址:http://www.cnblogs.com/pylab/p/4573495.html