filmov
tv
Python daemon threads 😈
Показать описание
python daemon threads tutorial example explained
#python #daemon #threads
# ************************************************************
# Python daemon threads
# ************************************************************
# daemon thread = a thread that runs in the background, not important for program to run
# your program will not wait for daemon threads to complete before exiting
# non-daemon threads cannot normally be killed, stay alive until task is complete
#
# ex. background tasks, garbage collection, waiting for input, long running processes
import threading
import time
def timer():
print()
count = 0
while True:
count += 1
print("logged in for: ", count, "seconds")
x = threading.Thread(target=timer, daemon=True)
answer = input("Do you wish to exit?")
# ************************************************************
Bro Code merch store 👟 :
===========================================================
===========================================================
#python #daemon #threads
# ************************************************************
# Python daemon threads
# ************************************************************
# daemon thread = a thread that runs in the background, not important for program to run
# your program will not wait for daemon threads to complete before exiting
# non-daemon threads cannot normally be killed, stay alive until task is complete
#
# ex. background tasks, garbage collection, waiting for input, long running processes
import threading
import time
def timer():
print()
count = 0
while True:
count += 1
print("logged in for: ", count, "seconds")
x = threading.Thread(target=timer, daemon=True)
answer = input("Do you wish to exit?")
# ************************************************************
Bro Code merch store 👟 :
===========================================================
===========================================================
Комментарии