Python Multiprocessing Kill Processes

后端 未结 2 999
死守一世寂寞
死守一世寂寞 2020-12-09 06:31

I am learning how to use the Python multiprocessing library. However, while I am going through some of the examples, I ended up with many python processes running in my back

2条回答
  •  心在旅途
    2020-12-09 06:57

    You need to .join() on your processes in a worker Queue, which will lock them to the calling application until all of them succeed or kill when the parent is killed, and run them in daemon mode.

    http://forums.xkcd.com/viewtopic.php?f=11&t=94726

    end daemon processes with multiprocessing module

    http://docs.python.org/2/library/multiprocessing.html#the-process-class

    http://www.python.org/dev/peps/pep-3143/#correct-daemon-behaviour

提交回复
热议问题