I worte a multiprocessing program in python. I use multiprocessing.Manager().list()
to share list within subprocess. At first, I add some tasks in main process.
The problem is that your main process is exiting immediately after you start all your worker processes, which shuts down your Manager
. When your Manager
shuts down, none of the children can use the shared list you passed into them. You can fix it by using join
to wait for all the children to finish. Just make sure you actually start
all your processes prior to calling join
:
for i in range(AMOUNT_OF_PROCESS):
processes[i] = multiprocessing.Process(target=worker, args=())
processes[i].start()
for process in processes:
process.join()