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;
|
long previous;
|
||||||
|
|
||||||
switch (WaitForSingleObject(handle, 0)) {
|
switch (WaitForSingleObjectEx(handle, 0, FALSE)) {
|
||||||
case WAIT_OBJECT_0:
|
case WAIT_OBJECT_0:
|
||||||
if (!ReleaseSemaphore(handle, 1, &previous))
|
if (!ReleaseSemaphore(handle, 1, &previous))
|
||||||
return MP_STANDARD_ERROR;
|
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 */
|
/* 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->last_tid = GetCurrentThreadId();
|
||||||
++self->count;
|
++self->count;
|
||||||
Py_RETURN_TRUE;
|
Py_RETURN_TRUE;
|
||||||
|
|
|
@ -1574,7 +1574,7 @@ floatsleep(double secs)
|
||||||
DWORD rc;
|
DWORD rc;
|
||||||
HANDLE hInterruptEvent = _PyOS_SigintEvent();
|
HANDLE hInterruptEvent = _PyOS_SigintEvent();
|
||||||
ResetEvent(hInterruptEvent);
|
ResetEvent(hInterruptEvent);
|
||||||
rc = WaitForSingleObject(hInterruptEvent, ul_millis);
|
rc = WaitForSingleObjectEx(hInterruptEvent, ul_millis, FALSE);
|
||||||
if (rc == WAIT_OBJECT_0) {
|
if (rc == WAIT_OBJECT_0) {
|
||||||
Py_BLOCK_THREADS
|
Py_BLOCK_THREADS
|
||||||
errno = EINTR;
|
errno = EINTR;
|
||||||
|
|
|
@ -535,7 +535,7 @@ run_child(wchar_t * cmdline)
|
||||||
error(RC_CREATE_PROCESS, L"Unable to create process using '%s'", cmdline);
|
error(RC_CREATE_PROCESS, L"Unable to create process using '%s'", cmdline);
|
||||||
AssignProcessToJobObject(job, pi.hProcess);
|
AssignProcessToJobObject(job, pi.hProcess);
|
||||||
CloseHandle(pi.hThread);
|
CloseHandle(pi.hThread);
|
||||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
WaitForSingleObjectEx(pi.hProcess, INFINITE, FALSE);
|
||||||
ok = GetExitCodeProcess(pi.hProcess, &rc);
|
ok = GetExitCodeProcess(pi.hProcess, &rc);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
error(RC_CREATE_PROCESS, L"Failed to get exit code of process");
|
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) {
|
if (GetLastError()==ERROR_OPERATION_ABORTED) {
|
||||||
hInterruptEvent = _PyOS_SigintEvent();
|
hInterruptEvent = _PyOS_SigintEvent();
|
||||||
switch (WaitForSingleObject(hInterruptEvent, 10)) {
|
switch (WaitForSingleObjectEx(hInterruptEvent, 10, FALSE)) {
|
||||||
case WAIT_OBJECT_0:
|
case WAIT_OBJECT_0:
|
||||||
ResetEvent(hInterruptEvent);
|
ResetEvent(hInterruptEvent);
|
||||||
return 1; /* Interrupt */
|
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
|
* but we are safe because we are using a semaphore wich has an internal
|
||||||
* count.
|
* count.
|
||||||
*/
|
*/
|
||||||
wait = WaitForSingleObject(cv->sem, ms);
|
wait = WaitForSingleObjectEx(cv->sem, ms, FALSE);
|
||||||
PyMUTEX_LOCK(cs);
|
PyMUTEX_LOCK(cs);
|
||||||
if (wait != WAIT_OBJECT_0)
|
if (wait != WAIT_OBJECT_0)
|
||||||
--cv->waiting;
|
--cv->waiting;
|
||||||
|
|
|
@ -130,7 +130,7 @@ FreeNonRecursiveMutex(PNRMUTEX mutex)
|
||||||
DWORD
|
DWORD
|
||||||
EnterNonRecursiveMutex(PNRMUTEX mutex, DWORD milliseconds)
|
EnterNonRecursiveMutex(PNRMUTEX mutex, DWORD milliseconds)
|
||||||
{
|
{
|
||||||
return WaitForSingleObject(mutex, milliseconds);
|
return WaitForSingleObjectEx(mutex, milliseconds, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
|
|
Loading…
Reference in New Issue