[issue1670] Threading.Condition.wait is non-iteruptable

Guido van Rossum report at bugs.python.org
Thu Dec 20 16:25:32 CET 2007


Guido van Rossum added the comment:

This can't be fixed directly -- the pthreads mutex is not an
interruptable system call.

However there's a simple (though expensive) work-around: use a very long
timeout. The timeout version of waiting for a lock is a busy-wait with a
short sleep (much less than a second I recall), and it is interruptable
while sleeping.

Only do this when it's really important to be interruptable -- the
busy-waiting makes your code use up battery power (see #1583).

----------
nosy: +gvanrossum
resolution:  -> wont fix
status: open -> closed

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1670>
__________________________________


More information about the Python-bugs-list mailing list