Lots of stuff happened
[progcomp2013.git] / qchess / thread_util.py
1 import threading
2
3 # A thread that can be stopped!
4 # Except it can only be stopped if it checks self.stopped() periodically
5 # So it can sort of be stopped
6 class StoppableThread(threading.Thread):
7         def __init__(self):
8                 threading.Thread.__init__(self)
9                 self._stop = threading.Event()
10
11         def stop(self):
12                 self._stop.set()
13
14         def stopped(self):
15                 return self._stop.isSet()

UCC git Repository :: git.ucc.asn.au