STINNER Victor added the comment:

> Python/condvar.h and Python/thread_pthread.h should use the monotonic clock 
> CLOCK_MONOTONIC

Oh, I forgot that Python/thread_pthread.h only uses pthread_cond_timedwait() if 
semaphores are emulated with mutexes+conditional variables.

On most platforms, PyThread_acquire_lock_timed() is implemented with 
sem_timedwait(). Problem: sem_timedwait() requires an absolute time using the 
CLOCK_REALTIME clock and the clock is not yet configurable on Linux :-(

See the feature request in the glibc: "Bug 14717 - Allow choice of clock source 
for calls to sem_timedwait() and pthread_mutex_timedwait()" opened in 2012:
https://sourceware.org/bugzilla/show_bug.cgi?id=14717

Note: QNX provides sem_timedwait_monotonic().

----------

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

Reply via email to