# HG changeset patch # User Atul Varma # Date 1252604605 25200 # Node ID fb0b161542b1699e586744d95da8cb9489143629 # Parent 2117265e4dfe2a87b5b62168fe2405b68638c7c9 Improved performance of watchdog thread. diff -r 2117265e4dfe -r fb0b161542b1 pydertron.py --- 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()