Message235637
Python 3.5 now requires a monotonic clock to start and has the C function _PyTime_monotonic().
Python/condvar.h and Python/thread_pthread.h should use the monotonic clock CLOCK_MONOTONIC, not the system clock CLOCK_REALTIME. See the PEP 418 for the rationale.
Most platforms support pthread_condattr_setclock(CLOCK_MONOTONIC), except Mac OS X and old versions of Android.
The glib looks to use pthread_cond_timedwait_relative_np() for Mac OS X:
https://mail.gnome.org/archives/commits-list/2014-February/msg07782.html
Note: Android had non-standard pthread_cond_timedwait_monotonic() and pthread_cond_timedwait_monotonic_np() functions. Android is not a official supported platform, and newer Android version now support pthread_condattr_setclock(). I prefer to not support old Android versions (yet).
https://android-review.googlesource.com/#/c/83881/
--
For Windows, SleepConditionVariableSRW() is used on Windows 7 and newer, otherwise WaitForSingleObjectEx() is used. By the way, the check looks to be done during the compilation. I should check which Windows version is used to build Python...
SleepConditionVariableSRW() and WaitForSingleObjectEx() both take a relative timeout, so they don't use (directly) the system clock. I don't see any required change for Windows.
According to the PEP 418: "WaitForSingleObject() uses the same timer as GetTickCount() with the same precision."
Hum, it is not possible to interrupt such wait() with CTRL+c? time.sleep() is implemented with WaitForSingleObjectEx() with _PyOS_SigintEvent(). It doesn't look to be the case here. |
|
Date |
User |
Action |
Args |
2015-02-09 21:34:27 | vstinner | set | recipients:
+ vstinner |
2015-02-09 21:34:27 | vstinner | set | messageid: <1423517667.9.0.82075564578.issue23428@psf.upfronthosting.co.za> |
2015-02-09 21:34:27 | vstinner | link | issue23428 messages |
2015-02-09 21:34:27 | vstinner | create | |
|