Skip to content

Conversation

@Livius90
Copy link
Contributor

@Livius90 Livius90 commented Sep 14, 2021

  • Add Waitable timer object to time.sleep() in Windows operation system.

Some previous pull request history can be found here: #28111

https://bugs.python.org/issue21302

Livius90 and others added 30 commits September 1, 2021 14:41
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.
@Livius90 Livius90 requested a review from vstinner September 16, 2021 17:35
@Livius90 Livius90 requested a review from vstinner September 16, 2021 21:56
@Livius90 Livius90 requested a review from vstinner September 20, 2021 19:20
@Livius90
Copy link
Contributor Author

Address sanitizer test failed again randomly, @vstinner can you re-run it somehow?

@vstinner
Copy link
Member

Address sanitizer test failed again randomly, @vstinner can you re-run it somehow?

That's the https://bugs.python.org/issue45200 issue.

@vstinner
Copy link
Member

I wrote a different implementation based on this PR, please see my PR #28483.

@vstinner
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants