[issue25084] remove semi-busy loop in py2.7 threading.Condition.wait(timeout=x)

STINNER Victor report at bugs.python.org
Tue Sep 15 00:34:50 CEST 2015


STINNER Victor added the comment:

As you noticed, this issue was correctly fixed in Python 3 by using the C timed acquire methods of locks, instead of polling. The problem is that Python 2 supports a wide range of threading models:

Python/thread_atheos.h
Python/thread_beos.h
Python/thread_cthread.h
Python/thread_lwp.h
Python/thread_nt.h
Python/thread_os2.h
Python/thread_pth.h
Python/thread_pthread.h
Python/thread_sgi.h
Python/thread_solaris.h
Python/thread_wince.h

In Python 3, it was possible to use more features of OS threads because we dropped all implementations to only keep the 2 major implementations:

Python/thread_nt.h
Python/thread_pthread.h

Your change adds a new feature to threading.Lock in Python 2:

-.. method:: Lock.acquire([blocking])
+.. method:: Lock.acquire(blocking=True, timeout=-1)

But features cannot be added to Python 2 anymore!

The backport changes critical C code. There is a (high) risk of introducing a regression.

I suggest to close this issue as WONTFIX.

@Benjamin (Python 2.7 release manager): What do you think?

In 2015, it's time to upgrade to Python 3! https://docs.python.org/3/howto/pyporting.html

----------
nosy: +benjamin.peterson, haypo

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25084>
_______________________________________


More information about the Python-bugs-list mailing list