mirror of https://github.com/python/cpython
Replace WaitForSingleObject with WaitForSingleObjectEx,
for better WinRT compatibility.
This commit is contained in:
parent
3f50bf652b
commit
b26a9b10ea
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -130,7 +130,7 @@ FreeNonRecursiveMutex(PNRMUTEX mutex)
|
|||
DWORD
|
||||
EnterNonRecursiveMutex(PNRMUTEX mutex, DWORD milliseconds)
|
||||
{
|
||||
return WaitForSingleObject(mutex, milliseconds);
|
||||
return WaitForSingleObjectEx(mutex, milliseconds, FALSE);
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
|
Loading…
Reference in New Issue