Add 'stop' method (rather than _stopThread) to StoppableThread

This commit is contained in:
Tim Savannah 2017-05-28 01:11:42 -04:00
parent 3f6d300aa0
commit 57aed88c7a

View File

@ -29,6 +29,16 @@ class StoppableThread(threading.Thread):
joinThread.start()
joinThread._stderr = self._stderr
def stop(self, exception):
'''
Stops the thread by raising a given exception.
@param exception <Exception> - Exception to throw. Likely, you want to use something
that inherits from BaseException (so except Exception as e: continue; isn't a problem)
'''
return self._stopThread(exception)
class JoinThread(threading.Thread):
'''
JoinThread - The workhouse that stops the StoppableThread