import threading

import threading
import time

class MyThread(threading.Thread):
    def __init__(self, area):
        threading.Thread.__init__(self)
        self.area = area


    def run(self):
        while True:
            self.area.writeValues()
            time.sleep(1)

    def stopThread(thread_name):
        for thread in threading.enumerate():
            if thread.name == thread_name:
                thread.join()

if __name__ == '__main__':
    thread1 = MyThread("Thread 1", 1)
    thread2 = MyThread("Thread 2", 2)

    thread1.start()
    thread2.start()

    thread1.join()
    thread2.join()

    print("Exiting main thread")
