Condition.wait(0.5) doesn't respect it's timeout

Piet van Oostrum piet at cs.uu.nl
Sun Apr 19 09:31:47 EDT 2009


>>>>> stephane.bisinger at gmail.com (sb) wrote:

>sb> I'll also file a bug report because I am more and more convinced this
>sb> is a bug, if anything else at least in the documentation...

I looked at it more closely, and I found that the Condition.wait is
stuck on obtaining the GIL while the main thread executes the gobject
main loop. Therefore it also blocks on notifications, not only on the
timeout. 

It appears that GTK and Python threads are incompatible UNLESS you call
gtk.gdk.threads_init() before gtk.main(). In your case you can do it
after the import gtk in contact_list.py. Then it should work.

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.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list