From b26a9b10ea5f095da0c699e41b29a724021cd09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Fri, 25 Jan 2013 14:25:48 +0100 Subject: Replace WaitForSingleObject with WaitForSingleObjectEx, for better WinRT compatibility. --- Modules/_multiprocessing/semaphore.c | 4 ++-- Modules/timemodule.c | 2 +- PC/launcher.c | 2 +- Parser/myreadline.c | 2 +- Python/condvar.h | 2 +- Python/thread_nt.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c index eb3fa0c..bdf56a9 100644 --- a/Modules/_multiprocessing/semaphore.c +++ b/Modules/_multiprocessing/semaphore.c @@ -43,7 +43,7 @@ _GetSemaphoreValue(HANDLE handle, long *value) { long previous; - switch (WaitForSingleObject(handle, 0)) { + switch (WaitForSingleObjectEx(handle, 0, FALSE)) { case WAIT_OBJECT_0: if (!ReleaseSemaphore(handle, 1, &previous)) return MP_STANDARD_ERROR; @@ -99,7 +99,7 @@ semlock_acquire(SemLockObject *self, PyObject *args, PyObject *kwds) } /* check whether we can acquire without releasing the GIL and blocking */ - if (WaitForSingleObject(self->handle, 0) == WAIT_OBJECT_0) { + if (WaitForSingleObjectEx(self->handle, 0, FALSE) == WAIT_OBJECT_0) { self->last_tid = GetCurrentThreadId(); ++self->count; Py_RETURN_TRUE; diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 8a81c8c..d5ffdcc 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -1574,7 +1574,7 @@ floatsleep(double secs) DWORD rc; HANDLE hInterruptEvent = _PyOS_SigintEvent(); ResetEvent(hInterruptEvent); - rc = WaitForSingleObject(hInterruptEvent, ul_millis); + rc = WaitForSingleObjectEx(hInterruptEvent, ul_millis, FALSE); if (rc == WAIT_OBJECT_0) { Py_BLOCK_THREADS errno = EINTR; diff --git a/PC/launcher.c b/PC/launcher.c index dfad44a..df2580b 100644 --- a/PC/launcher.c +++ b/PC/launcher.c @@ -535,7 +535,7 @@ run_child(wchar_t * cmdline) error(RC_CREATE_PROCESS, L"Unable to create process using '%s'", cmdline); AssignProcessToJobObject(job, pi.hProcess); CloseHandle(pi.hThread); - WaitForSingleObject(pi.hProcess, INFINITE); + WaitForSingleObjectEx(pi.hProcess, INFINITE, FALSE); ok = GetExitCodeProcess(pi.hProcess, &rc); if (!ok) error(RC_CREATE_PROCESS, L"Failed to get exit code of process"); diff --git a/Parser/myreadline.c b/Parser/myreadline.c index d864623..8b27045 100644 --- a/Parser/myreadline.c +++ b/Parser/myreadline.c @@ -68,7 +68,7 @@ my_fgets(char *buf, int len, FILE *fp) */ if (GetLastError()==ERROR_OPERATION_ABORTED) { hInterruptEvent = _PyOS_SigintEvent(); - switch (WaitForSingleObject(hInterruptEvent, 10)) { + switch (WaitForSingleObjectEx(hInterruptEvent, 10, FALSE)) { case WAIT_OBJECT_0: ResetEvent(hInterruptEvent); return 1; /* Interrupt */ diff --git a/Python/condvar.h b/Python/condvar.h index fe6bd74..72b08f9 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; diff --git a/Python/thread_nt.h b/Python/thread_nt.h index 938bf1e..bd604fb 100644 --- a/Python/thread_nt.h +++ b/Python/thread_nt.h @@ -130,7 +130,7 @@ FreeNonRecursiveMutex(PNRMUTEX mutex) DWORD EnterNonRecursiveMutex(PNRMUTEX mutex, DWORD milliseconds) { - return WaitForSingleObject(mutex, milliseconds); + return WaitForSingleObjectEx(mutex, milliseconds, FALSE); } BOOL -- cgit v0.12