标签:proc __name__ one style time target ssi name from
1.
#_*_coding:utf-8_*_ from multiprocessing import Process,Lock import os,time def f(l,i): #加锁 l.acquire() print(‘hello‘,i) #释放锁 l.release() if __name__ == ‘__main__‘: lock=Lock() for i in range(5): p=Process(target=f,args=(lock,i)).start()
输出
hello 4 hello 1 hello 2 hello 0 hello 3
标签:proc __name__ one style time target ssi name from
原文地址:https://www.cnblogs.com/sea-stream/p/10333493.html