Xavier de Gaye added the comment:

On a heavily loaded system, there is no guarantee that the date obtained from a 
call to gettimeofday() in PyCOND_TIMEDWAIT(), is not in the past when 
pthread_cond_timedwait() is called, as there may be a context switch in 
between. When this happens, a Python thread cannot take the gil even if it is 
available.

This tentative patch monitors the load of the system and dynamically increases 
the value used for the switch interval when needed. With this patch on the 
android-21-armv7 emulator:

python -m test -m test_lru_cache_threaded -v test_functools
Ok
python -m test -m test_deadlock -v test_importlib
Ok
python -m test -m test_is_alive_after_fork -v test_threading
Ok

The measured elapsed time is not correct in this patch when it is above 1 
second.

----------
Added file: http://bugs.python.org/file42874/pycond_timedwait.patch

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

Reply via email to