mirror of
https://github.com/python/cpython.git
synced 2025-07-19 17:25:54 +00:00
bpo-33316: PyThread_release_lock always fails (GH-6541)
Use correct interpretation of return value from APIs.
This commit is contained in:
parent
00e9c55d27
commit
05e922136a
2 changed files with 4 additions and 2 deletions
|
@ -0,0 +1 @@
|
||||||
|
PyThread_release_lock always fails
|
|
@ -104,8 +104,9 @@ LeaveNonRecursiveMutex(PNRMUTEX mutex)
|
||||||
if (PyMUTEX_LOCK(&mutex->cs))
|
if (PyMUTEX_LOCK(&mutex->cs))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
mutex->locked = 0;
|
mutex->locked = 0;
|
||||||
result = PyCOND_SIGNAL(&mutex->cv);
|
/* condvar APIs return 0 on success. We need to return TRUE on success. */
|
||||||
result &= PyMUTEX_UNLOCK(&mutex->cs);
|
result = !PyCOND_SIGNAL(&mutex->cv);
|
||||||
|
PyMUTEX_UNLOCK(&mutex->cs);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue