Python multiprocessing Queue failure

后端 未结 3 1133
旧时难觅i
旧时难觅i 2021-02-04 15:12

I create 100 child processes

proc_list = [
    Process(target = simulator, args=(result_queue,))
    for i in xrange(100)]

and start them

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 15:46

    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.

提交回复
热议问题