-
-
Couldn't load subscription status.
- Fork 33.2k
gh-135871: Fix needless spinning in _PyMutex_LockTimed (timeout==0) #135872
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
Changes from 3 commits
7296a7d
4b5123c
8a4e9ad
3fb8f37
8cbb992
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Improve internal lock performance on the free threaded build. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
| } | ||
|
|
||
|
|
@@ -89,6 +89,7 @@ _PyMutex_LockTimed(PyMutex *m, PyTime_t timeout, _PyLockFlags flags) | |
| // Spin for a bit. | ||
| _Py_yield(); | ||
| spin_count++; | ||
| v = _Py_atomic_load_uint8_relaxed(&m->_bits); | ||
|
||
| continue; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.