On Apr 19, 7:21 pm, Piet van Oostrum <p...@cs.uu.nl> wrote: > while time.time() - t < 0.5 or not self._modified: > print >> sys.stderr, "Going to sleep\n" > self._mod_lock.wait(timeout=1) > print >> sys.stderr, "Ok time to see if we must repaint" > self.__repaint() > t = time.time() > > But the timeout thing will continue after that, so you have a continuous > polling loop which wastes some CPU time. I think what you want can be > more easily achieved by doing a sleep(0.5) before the outer while loop, > i.e. as the first statement in __thread_run.
Two boolean checks every half second is not a great waste; but thinking about your solution I've come to agree that it is smarter and more effective. Thank you again! -- http://mail.python.org/mailman/listinfo/python-list