mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
Fix needless spinning in _PyMutex_LockTimed
with zero timeout (gh-135872)
The free threading build could spin unnecessarily on `_Py_yield()` if the initial compare and swap failed.
This commit is contained in:
parent
a88b49c3f2
commit
cbfaf41caf
2 changed files with 3 additions and 1 deletions
|
@ -58,7 +58,7 @@ _PyMutex_LockTimed(PyMutex *m, PyTime_t timeout, _PyLockFlags flags)
|
|||
return PY_LOCK_ACQUIRED;
|
||||
}
|
||||
}
|
||||
else if (timeout == 0) {
|
||||
if (timeout == 0) {
|
||||
return PY_LOCK_FAILURE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue