Commit 05e92213 authored by native-api's avatar native-api Committed by Steve Dower

bpo-33316: PyThread_release_lock always fails (GH-6541)

Use correct interpretation of return value from APIs.
parent 00e9c55d
...@@ -104,8 +104,9 @@ LeaveNonRecursiveMutex(PNRMUTEX mutex) ...@@ -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;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment