Mercurial > pydertron
changeset 8:fb0b161542b1
Improved performance of watchdog thread.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Thu, 10 Sep 2009 10:43:25 -0700 |
parents | 2117265e4dfe |
children | a88d1cc4db92 |
files | pydertron.py |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/pydertron.py Thu Sep 10 01:11:01 2009 -0700 +++ b/pydertron.py Thu Sep 10 10:43:25 2009 -0700 @@ -1,6 +1,5 @@ import os import sys -import time import threading import traceback import weakref @@ -17,7 +16,7 @@ # Default interval, in seconds, that the operation callbacks are # triggered at. - DEFAULT_INTERVAL = 0.15 + DEFAULT_INTERVAL = 0.25 def __init__(self, interval=DEFAULT_INTERVAL): threading.Thread.__init__(self) @@ -39,7 +38,6 @@ def run(self): while not self._stop.isSet(): - time.sleep(self.interval) new_list = [] self._lock.acquire() try: @@ -52,6 +50,7 @@ self._contexts = new_list finally: self._lock.release() + self._stop.wait(self.interval) # Create a global watchdog. watchdog = ContextWatchdogThread()