Python comment redémarrer le fil
# You can not restart a thread in python
# However you can make sure it stays alive forever
# If threads ending is a problem just loop them forever
# Example:
import threading
import time
class mythreader(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.setDaemon(True)
self.running = True
self.start()
def run(self):
mycounter = 0
while self.running:
do_some_cool_stuff()
time.sleep(2)
Flyhouse_Squarewheel