I create 100 child processes
proc_list = [
Process(target = simulator, args=(result_queue,))
for i in xrange(100)]
for proc in proc_list: proc.start()
def simulate(alg_instance, image_ids, gamma, results,
(rs, qs, t_us) = alg_instance.simulate_multiple(image_ids, gamma,
all_tuples = zip(rs, qs, t_us)
for result in all_tuples:
My solution to multiprocessing issues is almost always to use the Manager objects. While the exposed interface is the same, the underlying implementation is much simpler and has less bugs.
from multiprocessing import Manager manager = Manager() result_queue = manager.Queue()
Try it out and see if it doesn't fix your issues.