mirror of
https://github.com/python/cpython.git
synced 2026-04-22 03:41:08 +00:00
bpo-33316: PyThread_release_lock always fails (GH-6541)
Use correct interpretation of return value from APIs.
(cherry picked from commit 05e922136a)
Co-authored-by: native-api <ivan_pozdeev@mail.ru>
This commit is contained in:
parent
a2f4c40233
commit
c851dfc99b
2 changed files with 4 additions and 2 deletions
|
|
@ -104,8 +104,9 @@ LeaveNonRecursiveMutex(PNRMUTEX mutex)
|
|||
if (PyMUTEX_LOCK(&mutex->cs))
|
||||
return FALSE;
|
||||
mutex->locked = 0;
|
||||
result = PyCOND_SIGNAL(&mutex->cv);
|
||||
result &= PyMUTEX_UNLOCK(&mutex->cs);
|
||||
/* condvar APIs return 0 on success. We need to return TRUE on success. */
|
||||
result = !PyCOND_SIGNAL(&mutex->cv);
|
||||
PyMUTEX_UNLOCK(&mutex->cs);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue