From 729167bcaa47901b4918cf6148f27cb97fa23726 Mon Sep 17 00:00:00 2001 From: "Martin v. L?wis" Date: Fri, 25 Jan 2013 14:25:48 +0100 Subject: Replace WaitForSingleObject with WaitForSingleObjectEx, for better WinRT compatibility. --- Python/condvar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python/condvar.h') diff --git a/Python/condvar.h b/Python/condvar.h index fe6bd74da8..72b08f98c0 100644 --- a/Python/condvar.h +++ b/Python/condvar.h @@ -242,7 +242,7 @@ _PyCOND_WAIT_MS(PyCOND_T *cv, PyMUTEX_T *cs, DWORD ms) * but we are safe because we are using a semaphore wich has an internal * count. */ - wait = WaitForSingleObject(cv->sem, ms); + wait = WaitForSingleObjectEx(cv->sem, ms, FALSE); PyMUTEX_LOCK(cs); if (wait != WAIT_OBJECT_0) --cv->waiting; -- cgit v1.2.1 From 1010538749db6a0f9fc5143c8bd78528ba6c2b0d Mon Sep 17 00:00:00 2001 From: Kristj?n Valur J?nsson Date: Tue, 19 Mar 2013 20:18:37 -0700 Subject: Issue #15038 : Fixing the condition broadcast and docs. --- Python/condvar.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Python/condvar.h') diff --git a/Python/condvar.h b/Python/condvar.h index 72b08f98c0..e022dc7938 100644 --- a/Python/condvar.h +++ b/Python/condvar.h @@ -163,10 +163,9 @@ PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, long us) 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 @@ PyCOND_SIGNAL(PyCOND_T *cv) 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; } -- cgit v1.2.1