8000 bpo-33316: PyThread_release_lock always fails (GH-6541) · python/cpython@05e9221 · GitHub
[go: up one dir, main page]

Skip to content

Commit 05e9221

Browse files
native-apizooba
authored andcommitted
bpo-33316: PyThread_release_lock always fails (GH-6541)
Use correct interpretation of return value from APIs.
1 parent 00e9c55 commit 05e9221

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PyThread_release_lock always fails

Python/thread_nt.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ LeaveNonRecursiveMutex(PNRMUTEX mutex)
104104
if (PyMUTEX_LOCK(&mutex->cs))
105105
return FALSE;
106106
mutex->locked = 0;
107-
result = PyCOND_SIGNAL(&mutex->cv);
108-
result &= PyMUTEX_UNLOCK(&mutex->cs);
107+
/* condvar APIs return 0 on success. We need to return TRUE on success. */
108+
result = !PyCOND_SIGNAL(&mutex->cv);
109+
PyMUTEX_UNLOCK(&mutex->cs);
109110
return result;
110111
}
111112

0 commit comments

Comments
 (0)
0