diff options
author | Luo Jinghua <sunmoon1997@gmail.com> | 2010-11-15 10:59:01 +0800 |
---|---|---|
committer | Luo Jinghua <sunmoon1997@gmail.com> | 2010-11-15 10:59:01 +0800 |
commit | 3ee3491246f62f12449972b83743cd527040b4ce (patch) | |
tree | 47ae670feb08e0c0469eb12266fe5e3a57c881c5 | |
parent | 5ccb496fd1d6c97eb369e8904d5b8209ae02d548 (diff) |
threadpool: added a cancel method
-rw-r--r-- | totem/plugin/threadpool.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/totem/plugin/threadpool.py b/totem/plugin/threadpool.py index 31ac724..1d6b986 100644 --- a/totem/plugin/threadpool.py +++ b/totem/plugin/threadpool.py @@ -156,6 +156,11 @@ class ThreadPool: def is_busy(self): return self.get_num_tasks() != 0 + def cancel(self): + self.__taskLock.acquire() + self.__tasks = [] + self.__taskLock.release() + class ThreadPoolThread(threading.Thread): """ Pooled thread class. """ |