Python 进程 lock

from multiprocessing import Process,Lock

def run_lock(l,i):
l.acquire()
print("Hello ",i)
l.release()
l=Lock()
if __name__=="__main__":
for i in range(10):
p=Process(target=run_lock,args=(l,i))
p.start()
posted @ 2017-10-29 07:55  沧海一粒水  阅读(159)  评论(0编辑  收藏  举报