1、问题:
群中有同学贴了如下一段代码,问为何 list 最后打印的是空值?
frommultiprocessingimportProcess,Manager
importos
manager=Manager()
vip_list=[]
#vip_list=manager.list()
deftestFunc(cc):
vip_list.append(cc)
printprocessid:,os.getpid()
if__name__==\__main__:
threads=[]
forllinrange(10):
t=Process(target=testFunc,args=(ll,))
t.daemon=True
threads.append(t)
foriinrange(len(threads)):
threads[i].start()
forjinrange(len(threads)):
threads[j].join()
print"------------------------"
printp