Commit f8969459 authored by Yuxin Wu's avatar Yuxin Wu

cannot use thread._stop in py3

parent 8d3c709c
...@@ -29,15 +29,15 @@ class StoppableThread(threading.Thread): ...@@ -29,15 +29,15 @@ class StoppableThread(threading.Thread):
""" """
def __init__(self): def __init__(self):
super(StoppableThread, self).__init__() super(StoppableThread, self).__init__()
self._stop = threading.Event() self._stop_evt = threading.Event()
def stop(self): def stop(self):
""" stop the thread""" """ stop the thread"""
self._stop.set() self._stop_evt.set()
def stopped(self): def stopped(self):
""" check whether the thread is stopped or not""" """ check whether the thread is stopped or not"""
return self._stop.isSet() return self._stop_evt.isSet()
def queue_put_stoppable(self, q, obj): def queue_put_stoppable(self, q, obj):
""" put obj to queue, but will give up if the thread is stopped""" """ put obj to queue, but will give up if the thread is stopped"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment