homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2015年02月09日.21:34:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1423517667.9.0.82075564578.issue23428@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015年02月09日 21:34:27vstinnersetrecipients: + vstinner
2015年02月09日 21:34:27vstinnersetmessageid: <1423517667.9.0.82075564578.issue23428@psf.upfronthosting.co.za>
2015年02月09日 21:34:27vstinnerlinkissue23428 messages
2015年02月09日 21:34:27vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /