summaryrefslogtreecommitdiffstats
path: root/Lib/threading.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/threading.py')
-rw-r--r--Lib/threading.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/threading.py b/Lib/threading.py
index 4906674..fbf40cd 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -489,12 +489,12 @@ def Timer(*args, **kwargs):
class _Timer(Thread):
"""Call a function after a specified number of seconds:
-
+
t = Timer(30.0, f, args=[], kwargs={})
t.start()
t.cancel() # stop the timer's action if it's still waiting
"""
-
+
def __init__(self, interval, function, args=[], kwargs={}):
Thread.__init__(self)
self.interval = interval
@@ -502,11 +502,11 @@ class _Timer(Thread):
self.args = args
self.kwargs = kwargs
self.finished = Event()
-
+
def cancel(self):
"""Stop the timer if it hasn't finished yet"""
self.finished.set()
-
+
def run(self):
self.finished.wait(self.interval)
if not self.finished.isSet():