Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
21 lines (16 sloc) 606 Bytes
import threading
class JobThread(threading.Thread):
"""Thread that executes a job every N milliseconds"""
def __init__(self, func, reference):
self._finished = threading.Event()
self._func = func
self._reference = reference
def shutdown(self):
"""Stop this thread"""
def run(self):
"""Keep running this thread until it's stopped"""
while not self._finished.isSet():
self._finished.wait(self._func._interval / 1000.0)
Something went wrong with that request. Please try again.