[issue23428] Use the monotonic clock for thread conditions on POSIX platforms
STINNER Victor
report at bugs.python.org
Mon Feb 9 23:12:06 CET 2015
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 <report at bugs.python.org>
<http://bugs.python.org/issue23428>
_______________________________________
More information about the Python-bugs-list
mailing list