-
-
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 nanosleep() implementation for time.sleep() in Unix #28526
Conversation
Replace outdated select() to use nanosleep() for sleep implementation in Unix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to restrict this PR to using nanosleep() in time.sleep(), and nothing else. IMO it's already complex enough :-)
@@ -2074,7 +2076,11 @@ pysleep(_PyTime_t secs) | |||
#endif | |||
|
|||
do { | |||
#ifndef HAVE_CLOCK_NANOSLEEP | |||
#if defined(HAVE_NANOSLEEP) && !defined(HAVE_CLOCK_NANOSLEEP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change LGTM, but I propose to write the #ifdef
dance differently and rename secs
to timeout
to make the code more readable. I created PR #28545 based on your PR. Is it better? For the main code in Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS, I merged the 3 code paths to put if #ifdef
in the Py_BEGIN_ALLOW_THREADS block. What do you think?
I merged PR #28545. |
Some previous pull request history can be found here: #28111, #28341, #28483
https://bugs.python.org/issue21302