GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-21302: Add Waitable timer implementation for time.sleep() in Windows by Livius90 · Pull Request #28341 · python/cpython

Conversation

@Livius90

@Livius90 Livius90 commented Sep 14, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • 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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Livius90 and others added 30 commits September 1, 2021 14:41
@Livius90
clock_nanosleep() implementation for time.sleep()
55faeb6
clock_nanosleep() is available in Linux which has POSIX 2001.12 or newer
@Livius90
Follow PEP 7 rules in time.sleep()
c7bae3b
PEP 7 rules appled for _PyTime_AsTimespec and _PyTime_AsTimeval error checking in pysleep().
@Livius90
Adjust braces to PEP 7
b3a5c5f
@Livius90
clock_nanosleep check placed after clock_settime
3e07f39
@Livius90
Fix EINTR issue for clock_nanosleep()
e06ba84
In calling clock_nanosleep() EINTR is not stored in errno. Need to use return value of clock_nanosleep()/select() for checking it.
@blurb-it
📜🤖 Added by blurb_it.
6e6d4a3
@Livius90
nanosleep() is available for Unix systems like OSX, FreeBSD
238f073
@Livius90
Update news rst file
b5a5c6e
Unix operating systems eg: Linux, macOS, FreeBSD etc. time.sleep() has a resolution of nanoseconds with using clock_nanosleep() or nanosleep() function.
@Livius90
replace select() with nanosleep()
d064255
In all Unix systems eg: macOS, FreeBSD, Linux etc, nanosleep() is available.
@blurb-it
📜🤖 Added by blurb_it.
b70f187
@Livius90
Fix test_eintr issue for macOS
6ad7c14
@Livius90
Remove news rst and regenerate
74c45e1
@blurb-it
📜🤖 Added by blurb_it.
5988222
@Livius90
Use waitable timer from Win32 for time.sleep() in Windows
129b0a0
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.
@Livius90
Finalized waitable timer for time.sleep() in Windows
d89e13b
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.
@blurb-it
📜🤖 Added by blurb_it.
47249f5
@Livius90
Fix macOS build issue
0bf8330
@blurb-it
📜🤖 Added by blurb_it.
085cbed
@Livius90
Final optimization in Waitable timer object implementation
2242638
@blurb-it
📜🤖 Added by blurb_it.
db7851b
@Livius90
revert to original
f7387e8
@Livius90
remove news
a35b0b4
@Livius90
add clock_nanosleep() only
3abf812
@blurb-it
📜🤖 Added by blurb_it.
4cbfde2
@Livius90 @vstinner
Update Misc/NEWS.d/next/Library/2021-09-10-00-24-08.bpo-21302.XS_frc.rst
d99c06e
suggested description

Co-authored-by: Victor Stinner <[email protected]>
@Livius90
timeout_abs renaming
117dc62
@Livius90
Simplified HAVE_CLOCK_NANOSLEEP macro blocks
92061f3
@Livius90
remake news
f045047
@blurb-it
📜🤖 Added by blurb_it.
24f9975
@Livius90
Fix err checking
34e3883
@Livius90
Livius90 requested review from abalkin and pganssle as code owners September 14, 2021 20:36
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Sep 14, 2021
@bedevere-bot bedevere-bot added the awaiting review label Sep 14, 2021
@blurb-it
📜🤖 Added by blurb_it.
79a06c4
vstinner
vstinner reviewed Sep 14, 2021
View reviewed changes
Comment thread Modules/timemodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/timemodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/timemodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/timemodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Livius90 and others added 7 commits September 15, 2021 00:52
@Livius90
Revert "📜🤖 Added by blurb_it."
6fb2c1d
This reverts commit 79a06c4.
@Livius90
Fix timer handle closing, simplify ifdef blocks
41fe5d8
@Livius90
Merge branch 'python:main' into bpo-21302
6fc19ad
@Livius90
Add _PyTime_As100Nanoseconds()
ac8ab07
@Livius90
Fix test_eintr failed issue in macOS
b79ce48
@blurb-it
📜🤖 Added by blurb_it.
7a3fbc2
@Livius90
time.sleep() sleep again if SIGINT does not raise an exception
4e7c4eb
@Livius90
Livius90 requested a review from vstinner September 16, 2021 17:35
vstinner
vstinner reviewed Sep 16, 2021
View reviewed changes
Comment thread Modules/timemodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Livius90
use WaitForMultipleObjectsEx()
ab17401
@Livius90
Livius90 requested a review from vstinner September 16, 2021 21:56
@Livius90
Some code refactoring and finalizing
d2eb0fc
vstinner
vstinner reviewed Sep 20, 2021
View reviewed changes
Comment thread Modules/timemodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/timemodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/timemodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Misc/NEWS.d/next/Library/2021-09-15-23-49-21.bpo-21302.KTsR8i.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/timemodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/timemodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Livius90 added 2 commits September 20, 2021 14:13
@Livius90
Fulfilling requests of last review
aad2c31
@Livius90
Update news rst
0daf080
@Livius90
Livius90 requested a review from vstinner September 20, 2021 19:20
@Livius90

Livius90 commented Sep 20, 2021

Copy link
Copy Markdown
Contributor Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Sep 20, 2021

Copy link
Copy Markdown
Member

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

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Sep 20, 2021

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Sep 22, 2021

Copy link
Copy Markdown
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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner closed this Sep 22, 2021
@Livius90
Livius90 deleted the bpo-21302 branch September 22, 2021 20:11
@Livius90 Livius90 mentioned this pull request Sep 22, 2021
bpo-21302: Add nanosleep() implementation for time.sleep() in Unix #28526
Closed
@shankarunni shankarunni mannequin mentioned this pull request Nov 12, 2022
time.sleep (floatsleep()) should use clock_nanosleep() on Linux #65501
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@abalkin abalkin Awaiting requested review from abalkin
@pganssle pganssle Awaiting requested review from pganssle pganssle is a code owner
@vstinner vstinner Awaiting requested review from vstinner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@Livius90 @vstinner @the-knights-who-say-ni @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.