Mercurial > cpython-lru_cache-weakref
diff Python/condvar.h @ 82818:fde60d3f542e 3.3
Issue #15038 : Fixing the condition broadcast and docs.
| author | Kristján Valur Jónsson <sweskman@gmail.com> |
|---|---|
| date | Tue, 19 Mar 2013 20:18:37 -0700 |
| parents | d7a72fdcc168 |
| children | c6af0b3de726 |
line wrap: on
line diff
--- a/Python/condvar.h Tue Mar 19 16:46:34 2013 -0700 +++ b/Python/condvar.h Tue Mar 19 20:18:37 2013 -0700 @@ -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; }
