>>>>> [email protected] (sb) wrote:
>>> By the way, I wonder why you need a timeout in your wait. I think the
>>> notifications should be sufficient to keep the gui updated.
>sb> The reason is simple: when first downloading the contactss list, I
>sb> receive a swarm of *Updated() calls, so if I redraw every time I get a
>sb> very bad visual effect and I waste a lot of CPU redrawing something
>sb> that will change in a very very short time. Hence the time
>sb> constraint... I couldn't come up with something smarter, so...
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.
--
Piet van Oostrum <[email protected]>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: [email protected]
--
http://mail.python.org/mailman/listinfo/python-list