diff --git a/func_timeout/StoppableThread.py b/func_timeout/StoppableThread.py index 8c6a6ac..9dbc013 100644 --- a/func_timeout/StoppableThread.py +++ b/func_timeout/StoppableThread.py @@ -32,15 +32,16 @@ class JoinThread(threading.Thread): JoinThread - The workhouse that stops the StoppableThread ''' - def __init__(self, otherThread, exception): + def __init__(self, otherThread, exception, repeatEvery=2.0): threading.Thread.__init__(self) self.otherThread = otherThread self.exception = exception + self.repeatEvery = repeatEvery self.daemon = True def run(self): while self.otherThread.isAlive(): # We loop raising exception incase it's caught hopefully this breaks us far out. ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(self.otherThread.ident), ctypes.py_object(self.exception)) - self.otherThread.join(2) + self.otherThread.join(self.repeatEvery)