DEAMON THREADS IN PYTHON|CODEJAL|

Pubblicato il: 25 aprile 2024
sul canale di: codejal
4
0

#Sometimes, it is necessary to execute a task in the background. A special type of thread is used for background tasks, called a daemon thread. In other words, daemon threads execute tasks in the background.
import time
import threading
def timer():
count=0
while True:
time.sleep(1)
count+=1
print("Logged in ",count,"count")
x=threading.Thread(target=timer,daemon=True)
x.start()
a=input("Would you like to log out and exit?:")
print("Shutting down...")


In questa pagina del sito puoi guardare il video online DEAMON THREADS IN PYTHON|CODEJAL| della durata di ore minuti seconda in buona qualità , che l'utente ha caricato codejal 25 aprile 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 4 volte e gli è piaciuto 0 spettatori. Buona visione!