Answer the question
In order to leave comments, you need to log in
How to terminate multiprocessing.Process while the same process is running?
There is a code where during the execution of the process a thread is started, how to terminate the process in the process itself? exit does not help, the thread continues its work
from threading import Thread
from multiprocessing import Process
from time import sleep
from sys import exit
def prcss():
Thread(target=thrd).start()
sleep(10)
print("Exit")
exit(0)
def thrd():
while True:
print("Running")
sleep(1.5)
prcs = Process(target=prcss)
prcs.start()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question