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()
转载于:https://www.cnblogs.com/xiesongyou/p/7749277.html