multiprocessing.Manager()returns multiprocessing.managers.SyncManager, if you see, when you created the list and the dictionary, you actually received your proxies. This means that you did not add to the list {0:0}that you created inside the manager, but a proxy (copy).
self.dict1=manager.dict({0:0})
self.lst.append(self.dict1)
self.lst.append({0:0})
So, in the updatelist method:
def updateList(self,l,i):
with self.lock:
for j in range(10):
self.lst[0][0]+=1
proxy = self.lst
dict = proxy[0]
dict[0]+=1
This means that you make copies, change them, and then do not use. You need to change to assign a list with a new value so that it changes for all processes:
def updateList(self,l,i):
with self.lock:
dict0 = self.lst[0]
for j in range(10):
dict0[0]+=1
self.lst[0] = dict0
source
share