summaryrefslogtreecommitdiffstats
path: root/Python/thread_nt.h
diff options
context:
space:
mode:
authornative-api <ivan_pozdeev@mail.ru>2019-02-02 16:22:55 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2019-02-02 16:22:55 (GMT)
commit05e922136a3286893bd489a8f2ecfa0dba4da368 (patch)
tree7a55264220909fe484efe8e656a94fbe9bb6bb75 /Python/thread_nt.h
parent00e9c55d27aff3e445ab4c8629cf4d59f46ff945 (diff)
downloadcpython-05e922136a3286893bd489a8f2ecfa0dba4da368.zip
cpython-05e922136a3286893bd489a8f2ecfa0dba4da368.tar.gz
cpython-05e922136a3286893bd489a8f2ecfa0dba4da368.tar.bz2
bpo-33316: PyThread_release_lock always fails (GH-6541)
Use correct interpretation of return value from APIs.
Diffstat (limited to 'Python/thread_nt.h')
-rw-r--r--Python/thread_nt.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/thread_nt.h b/Python/thread_nt.h
index 21ef555..fdb192b 100644
--- a/Python/thread_nt.h
+++ b/Python/thread_nt.h
@@ -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;
}