mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-26 18:50:32 +00:00
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:
parent
6e3e153754
commit
4c8dcb012b
1 changed files with 13 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue