◐ Shell
clean mode source ↗

gh-125997: suggest efficient alternatives for `time.sleep(0)` by picnixz · Pull Request #128752 · python/cpython

Skip to content

Navigation Menu

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

The implementation of `time.sleep()` changed in Python 3.11 and relies
on `clock_nanosleep()` or `nanosleep()` since then. This introduced a
regression in code using `time.sleep(0)` for a syscall "no-op", polling
or momentarily suspending the caller's thread.

To alleviate the performance regression, we suggest some alternatives
depending on the caller's needs.

StanFromIreland

hauntsaninja

vstinner

vstinner

ZeroIntensity

vstinner

@picnixz picnixz deleted the doc/time/sleep-125997 branch

January 18, 2025 11:02

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Jan 18, 2025
…ythonGH-128752)

(cherry picked from commit f4afaa6)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

picnixz added a commit that referenced this pull request

Jan 18, 2025

picnixz added a commit that referenced this pull request

Jan 18, 2025

srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request

Jan 21, 2025

Labels