You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
349 B
13 lines
349 B
9 months ago
|
import threading
|
||
|
|
||
|
class StoppableThread(threading.Thread):
|
||
|
def __init__(self, *args, **kwargs):
|
||
|
super().__init__(*args, **kwargs)
|
||
|
self._stop_event = threading.Event()
|
||
|
self._pause_event = threading.Event()
|
||
|
|
||
|
def stop(self):
|
||
|
self._stop_event.set()
|
||
|
|
||
|
def stopped(self):
|
||
|
return self._stop_event.is_set()
|