I did a little search and found out there is no way to kill a thread in python, but how would one solve a problem like me ?
I have a function that sets X to True for one hour and after that it sets it back to False.
sometimes the program finishes less than the needed hour, but the thread is still running and make garbage in memory.
def enableX():
self.x=True
sleep(3600)
self.x=False
def function1():
self.enableXThread=Thread(target=self.enableX)
self.enableXThread.start()
any idea ? how I can kill enbableXThread when the program terminates no matter if the thread is done or not ?