[issue12096] test_threading.test_waitfor() timeout (1 hour) on x86 Gentoo 3.x buildbot

Charles-François Natali report at bugs.python.org
Tue May 17 17:37:01 CEST 2011


Charles-François Natali <neologix at 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 <report at bugs.python.org>
<http://bugs.python.org/issue12096>
_______________________________________


More information about the Python-bugs-list mailing list