import time

class ThreadMonitor:
    def __init__(self, threads):
        self.threads = threads

    def list_running_threads(self):
        while True:
            f = open("active_threads.txt", "w")
            f.close()
            for thread in self.threads:
                if thread.is_alive():
                    with open("active_threads.txt", "a") as f:
                        f.write(
                            f"Thread Name: {thread.name}, Alive: {thread.is_alive()}\n"
                        )
            time.sleep(1)
