gh-135871: Fix needless spinning in _PyMutex_LockTimed (timeout==0) by jtibbertsma · Pull Request #135872 · python/cpython
…==0) * Move the timeout == 0 guard outside the else so a non-blocking call returns immediately after a failed CAS instead of entering the spin loop. * Reload v on every spin iteration, allowing timed/blocking callers to notice an unlock promptly. No-GIL builds now honor the semantics of non-blocking attempts and avoid wasted CPU; GIL builds are unaffected (MAX_SPIN_COUNT == 0).
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request
…ongh-135872) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed. (cherry picked from commit cbfaf41) Co-authored-by: Joseph Tibbertsma <josephtibbertsma@gmail.com>
colesbury pushed a commit to colesbury/cpython that referenced this pull request
pythongh-135872) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed. (cherry picked from commit cbfaf41) Co-authored-by: Joseph Tibbertsma <josephtibbertsma@gmail.com>
colesbury pushed a commit that referenced this pull request
colesbury added a commit that referenced this pull request
AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull request
…ongh-135872) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed.
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request
…ongh-135872) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed.
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request
…ongh-135872) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed.
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request
…ongh-135872) The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed.