[Python-checkins] cpython: Issue #15038 : Fixing the condition broadcast and docs.

kristjan.jonsson python-checkins at python.org
Wed Mar 20 04:35:54 CET 2013


http://hg.python.org/cpython/rev/08b87dda6f6a
changeset:   82817:08b87dda6f6a
user:        Kristján Valur Jónsson <sweskman at gmail.com>
date:        Tue Mar 19 20:18:37 2013 -0700
summary:
  Issue #15038 : Fixing the condition broadcast and docs.

files:
  Python/condvar.h |  12 ++++++------
  1 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/Python/condvar.h b/Python/condvar.h
--- a/Python/condvar.h
+++ b/Python/condvar.h
@@ -163,10 +163,9 @@
 
    Generic emulations of the pthread_cond_* API using
    earlier Win32 functions can be found on the Web.
-   The following read can be edificating (or not):
+   The following read can be give background information to these issues,
+   but the implementations are all broken in some way.
    http://www.cse.wustl.edu/~schmidt/win32-cv-1.html
-
-   See also 
 */
 
 typedef CRITICAL_SECTION PyMUTEX_T;
@@ -297,9 +296,10 @@
 Py_LOCAL_INLINE(int)
 PyCOND_BROADCAST(PyCOND_T *cv)
 {
-    if (cv->waiting > 0) {
-        return ReleaseSemaphore(cv->sem, cv->waiting, NULL) ? 0 : -1;
-		cv->waiting = 0;
+    int waiting = cv->waiting;
+    if (waiting > 0) {
+        cv->waiting = 0;
+        return ReleaseSemaphore(cv->sem, waiting, NULL) ? 0 : -1;
     }
     return 0;
 }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list