Charles-François Natali <neolo...@free.fr> added the comment:

The sleep is too short:

       def f():
           with cond:
               result = cond.wait_for(lambda : state==4)


      for i in range(5):
          time.sleep(0.01)
          with cond:
          state += 1
          cond.notify()


If state is incremented to 5 before the thread waits on the condition, it's 
going to wait forever (it can be reproduced easily by removing the sleep).
We could either increase the sleep, or change the predicate to state==5.

----------
nosy: +neologix

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12096>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to