added a stoppable thread object

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3305 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2006-05-24 22:29:22 +00:00
parent 6e3e153754
commit 4c8dcb012b

View file

@ -19,6 +19,7 @@ Support for managing threads.
"""
import os
import threading
try:
import win32process
_has_win32process = True
@ -65,3 +66,15 @@ def set_thread_priority (prio):
res = None
return res
class StoppableThread (threading.Thread):
def __init__ (self):
super(StoppableThread, self).__init__()
self._stop = threading.Event()
def stop (self):
self._stop.set()
def stopped (self):
return self._stop.isSet()