-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-21302: Add Waitable timer implementation for time.sleep() in Windows #28341
Conversation
clock_nanosleep() is available in Linux which has POSIX 2001.12 or newer
PEP 7 rules appled for _PyTime_AsTimespec and _PyTime_AsTimeval error checking in pysleep().
In calling clock_nanosleep() EINTR is not stored in errno. Need to use return value of clock_nanosleep()/select() for checking it.
Unix operating systems eg: Linux, macOS, FreeBSD etc. time.sleep() has a resolution of nanoseconds with using clock_nanosleep() or nanosleep() function.
In all Unix systems eg: macOS, FreeBSD, Linux etc, nanosleep() is available.
Waitable timer is 100 nsec resolution. Now, seconds to nanosec conversion is limited in usec, soon will come the next developing part to improve it in next commit.
Waitable timer resolution is 100 nsec but it is limited to 1 usec by round ceiling, moreover sleep for lower then 1 milisec is not possible in Win32 API.
suggested description Co-authored-by: Victor Stinner <[email protected]>
This reverts commit 79a06c4.
Misc/NEWS.d/next/Library/2021-09-15-23-49-21.bpo-21302.KTsR8i.rst
Outdated
Show resolved
Hide resolved
Address sanitizer test failed again randomly, @vstinner can you re-run it somehow? |
That's the https://bugs.python.org/issue45200 issue. |
I wrote a different implementation based on this PR, please see my PR #28483. |
Thanks @Livius90. I merged my PR which is based on yours but also enhance the documentation, contains a bugfix for SIGINT, and has a different implementation. |
Some previous pull request history can be found here: #28111
https://bugs.python.org/issue21302