import threading
import os
import time

class ThreadExit():
    
    def __init__(self):

        self.m_event = threading.Event()

    def init(self):
        self.m_thread = threading.Thread(target = self.runtine)

    def start(self):
        self.m_thread.start()

    def stop(self):
        self.m_event.set()

    def runtine(self):
        while True:
            if self.m_event.isSet() == True:
                break

            print("living")
            time.sleep(1)

if __name__ == '__main__':
   tr = ThreadExit()
   tr.init()
   tr.start()
   time.sleep(10)
   tr.stop()