]> granicus.if.org Git - python/commitdiff
Replace WaitForSingleObject with WaitForSingleObjectEx,
authorMartin v. Löwis <martin@v.loewis.de>
Fri, 25 Jan 2013 13:25:48 +0000 (14:25 +0100)
committerMartin v. Löwis <martin@v.loewis.de>
Fri, 25 Jan 2013 13:25:48 +0000 (14:25 +0100)
for better WinRT compatibility.

Modules/_multiprocessing/semaphore.c
Modules/timemodule.c
PC/launcher.c
Parser/myreadline.c
Python/condvar.h
Python/thread_nt.h

index eb3fa0ceb589680d2c02da30ca3be8194bf9dc48..bdf56a9f739bcb10d872b5f3b84781b71e365177 100644 (file)
@@ -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;
index 8a81c8cf1e9e15bae0e8cb2fa5cecf7573b5385b..d5ffdcccbae6ed6f908f1f2b3476a64b3f22a93f 100644 (file)
@@ -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;
index dfad44a35936befc6295a9f33f3ac63734a577db..df2580b337f99c077a0070cbde73dfdc2e344136 100644 (file)
@@ -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");
index d864623f1a2a37081cde8bf1638e4317ad5d23a1..8b27045f1d643cf6d480aa86f1d8b7804d3f5222 100644 (file)
@@ -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 */
index fe6bd74da8cc64e0385328f7701e635a306dcc7f..72b08f98c0084310a853fa1bf0f64cf03b64e944 100644 (file)
@@ -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;
index 938bf1e3fed0c6c1a66022e36c9fa80615ce22f9..bd604fbdd3945e99f9e7317b54ada83c43953044 100644 (file)
@@ -130,7 +130,7 @@ FreeNonRecursiveMutex(PNRMUTEX mutex)
 DWORD
 EnterNonRecursiveMutex(PNRMUTEX mutex, DWORD milliseconds)
 {
-    return WaitForSingleObject(mutex, milliseconds);
+    return WaitForSingleObjectEx(mutex, milliseconds, FALSE);
 }
 
 BOOL