Terminate a Python multiprocessing program once a one of its workers meets a certain condition

后端 未结 4 1587
一向
一向 2020-12-05 03:32

I am writing a Python program using its multiprocessing module. The program calls a number of worker functions, each yielding a random number. I need to terminate th

4条回答
  •  既然无缘
    2020-12-05 03:46

    You can terminate your Program simply by importing exit() from sys

    import sys 
    
    sys.exit()
    

提交回复
热议问题