No longer call WaitFor*Object* from ntdll (but NtWait*Object*).
This commit is contained in:
parent
ef141f721c
commit
14d04b608c
|
@ -146,23 +146,28 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit )
|
|||
{
|
||||
EXCEPTION_RECORD rec;
|
||||
HANDLE sem = get_semaphore( crit );
|
||||
LARGE_INTEGER time;
|
||||
DWORD status;
|
||||
|
||||
DWORD res = WaitForSingleObject( sem, 5000L );
|
||||
if ( res == WAIT_TIMEOUT )
|
||||
time.QuadPart = -5000 * 10000; /* 5 seconds */
|
||||
status = NtWaitForSingleObject( sem, FALSE, &time );
|
||||
if ( status == WAIT_TIMEOUT )
|
||||
{
|
||||
const char *name = (char *)crit->DebugInfo;
|
||||
if (!name) name = "?";
|
||||
ERR( "section %p %s wait timed out, retrying (60 sec) tid=%04lx\n",
|
||||
crit, debugstr_a(name), GetCurrentThreadId() );
|
||||
res = WaitForSingleObject( sem, 60000L );
|
||||
if ( res == WAIT_TIMEOUT && TRACE_ON(relay) )
|
||||
time.QuadPart = -60000 * 10000;
|
||||
status = NtWaitForSingleObject( sem, FALSE, &time );
|
||||
if ( status == WAIT_TIMEOUT && TRACE_ON(relay) )
|
||||
{
|
||||
ERR( "section %p %s wait timed out, retrying (5 min) tid=%04lx\n",
|
||||
crit, debugstr_a(name), GetCurrentThreadId() );
|
||||
res = WaitForSingleObject( sem, 300000L );
|
||||
time.QuadPart = -300000 * (ULONGLONG)10000;
|
||||
status = NtWaitForSingleObject( sem, FALSE, &time );
|
||||
}
|
||||
}
|
||||
if (res == STATUS_WAIT_0) return STATUS_SUCCESS;
|
||||
if (status == STATUS_WAIT_0) return STATUS_SUCCESS;
|
||||
|
||||
/* Throw exception only for Wine internal locks */
|
||||
if (!crit->DebugInfo) continue;
|
||||
|
|
|
@ -166,7 +166,7 @@ wait:
|
|||
rwl->uExclusiveWaiters++;
|
||||
|
||||
RtlLeaveCriticalSection( &rwl->rtlCS );
|
||||
if( WaitForSingleObject( rwl->hExclusiveReleaseSemaphore, INFINITE ) == WAIT_FAILED )
|
||||
if( NtWaitForSingleObject( rwl->hExclusiveReleaseSemaphore, FALSE, NULL ) == WAIT_FAILED )
|
||||
goto done;
|
||||
goto start; /* restart the acquisition to avoid deadlocks */
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ start:
|
|||
{
|
||||
rwl->uSharedWaiters++;
|
||||
RtlLeaveCriticalSection( &rwl->rtlCS );
|
||||
if( (dwWait = WaitForSingleObject( rwl->hSharedReleaseSemaphore, INFINITE )) == WAIT_FAILED )
|
||||
if( (dwWait = NtWaitForSingleObject( rwl->hSharedReleaseSemaphore, FALSE, NULL )) == WAIT_FAILED )
|
||||
goto done;
|
||||
goto start;
|
||||
}
|
||||
|
|
|
@ -1125,9 +1125,12 @@ static HANDLER_DEF(term_handler)
|
|||
*/
|
||||
static HANDLER_DEF(usr1_handler)
|
||||
{
|
||||
LARGE_INTEGER timeout;
|
||||
|
||||
init_handler( HANDLER_CONTEXT );
|
||||
/* wait with 0 timeout, will only return once the thread is no longer suspended */
|
||||
WaitForMultipleObjectsEx( 0, NULL, FALSE, 0, FALSE );
|
||||
timeout.QuadPart = 0;
|
||||
NtWaitForMultipleObjects( 0, NULL, FALSE, FALSE, &timeout );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -409,8 +409,11 @@ static HANDLER_DEF(term_handler)
|
|||
*/
|
||||
static HANDLER_DEF(usr1_handler)
|
||||
{
|
||||
LARGE_INTEGER timeout;
|
||||
|
||||
/* wait with 0 timeout, will only return once the thread is no longer suspended */
|
||||
WaitForMultipleObjectsEx( 0, NULL, FALSE, 0, FALSE );
|
||||
timeout.QuadPart = 0;
|
||||
NtWaitForMultipleObjects( 0, NULL, FALSE, FALSE, &timeout );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -384,8 +384,11 @@ static HANDLER_DEF(term_handler)
|
|||
*/
|
||||
static HANDLER_DEF(usr1_handler)
|
||||
{
|
||||
LARGE_INTEGER timeout;
|
||||
|
||||
/* wait with 0 timeout, will only return once the thread is no longer suspended */
|
||||
WaitForMultipleObjectsEx( 0, NULL, FALSE, 0, FALSE );
|
||||
timeout.QuadPart = 0;
|
||||
NtWaitForMultipleObjects( 0, NULL, FALSE, FALSE, &timeout );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue