xxxxxxxxxx
import threading
import time
def my_daemon_func():
while True:
print("Daemon thread is running...")
time.sleep(1)
# Create a daemon thread
daemon_thread = threading.Thread(target=my_daemon_func)
daemon_thread.daemon = True
daemon_thread.start()
# Perform main program logic
print("Main program is running...")
time.sleep(5)
print("Main program finished.")