[Python-checkins] cpython: Replace WaitForSingleObject with WaitForSingleObjectEx,

martin.v.loewis python-checkins at python.org
Fri Jan 25 14:26:30 CET 2013


http://hg.python.org/cpython/rev/b71b6517af63
changeset: 81712:b71b6517af63
user: Martin v. Löwis <martin at v.loewis.de>
date: Fri Jan 25 14:25:48 2013 +0100
summary:
 Replace WaitForSingleObject with WaitForSingleObjectEx,
for better WinRT compatibility.
files:
 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
--- a/Modules/_multiprocessing/semaphore.c
+++ b/Modules/_multiprocessing/semaphore.c
@@ -43,7 +43,7 @@
 {
 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 @@
 }
 
 /* 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
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -1574,7 +1574,7 @@
 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
--- a/PC/launcher.c
+++ b/PC/launcher.c
@@ -535,7 +535,7 @@
 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
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -68,7 +68,7 @@
 */
 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
--- a/Python/condvar.h
+++ b/Python/condvar.h
@@ -242,7 +242,7 @@
 * 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
--- a/Python/thread_nt.h
+++ b/Python/thread_nt.h
@@ -130,7 +130,7 @@
 DWORD
 EnterNonRecursiveMutex(PNRMUTEX mutex, DWORD milliseconds)
 {
- return WaitForSingleObject(mutex, milliseconds);
+ return WaitForSingleObjectEx(mutex, milliseconds, FALSE);
 }
 
 BOOL
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /