From 14d04b608cf9eaeebce3e64241bf91726207b855 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Thu, 3 Apr 2003 23:57:11 +0000 Subject: [PATCH] No longer call WaitFor*Object* from ntdll (but NtWait*Object*). --- dlls/ntdll/critsection.c | 17 +++++++++++------ dlls/ntdll/rtl.c | 4 ++-- dlls/ntdll/signal_i386.c | 5 ++++- dlls/ntdll/signal_powerpc.c | 5 ++++- dlls/ntdll/signal_sparc.c | 5 ++++- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/dlls/ntdll/critsection.c b/dlls/ntdll/critsection.c index 023323a0171..a0083b5ca16 100644 --- a/dlls/ntdll/critsection.c +++ b/dlls/ntdll/critsection.c @@ -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; diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index 54088c7ec73..3f92dc9b2cc 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -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; } diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index f3511d9d2bc..1ddf6f755ff 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -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 ); } diff --git a/dlls/ntdll/signal_powerpc.c b/dlls/ntdll/signal_powerpc.c index ee3a52c39c7..f9fce7409ac 100644 --- a/dlls/ntdll/signal_powerpc.c +++ b/dlls/ntdll/signal_powerpc.c @@ -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 ); } diff --git a/dlls/ntdll/signal_sparc.c b/dlls/ntdll/signal_sparc.c index 3019e8b1463..48071984124 100644 --- a/dlls/ntdll/signal_sparc.c +++ b/dlls/ntdll/signal_sparc.c @@ -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 ); }