Replace WaitForSingleObject with WaitForSingleObjectEx,

for better WinRT compatibility.
This commit is contained in:
Martin v. Löwis 2013-01-25 14:25:48 +01:00
parent 3f50bf652b
commit b26a9b10ea
6 changed files with 7 additions and 7 deletions

View 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;

View 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;

View 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");

View 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 */

View 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;

View File

@ -130,7 +130,7 @@ FreeNonRecursiveMutex(PNRMUTEX mutex)
DWORD
EnterNonRecursiveMutex(PNRMUTEX mutex, DWORD milliseconds)
{
return WaitForSingleObject(mutex, milliseconds);
return WaitForSingleObjectEx(mutex, milliseconds, FALSE);
}
BOOL