mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 22:20:26 +00:00
- NtWaitForSingleObject doesn't return WAIT_FAILED.
- Use STATUS_WAIT_0 not WAIT_OBJECT_0.
This commit is contained in:
parent
51c583f9a9
commit
6c45b62679
@ -167,10 +167,13 @@ start:
|
||||
wait:
|
||||
if( fWait )
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
||||
rwl->uExclusiveWaiters++;
|
||||
|
||||
RtlLeaveCriticalSection( &rwl->rtlCS );
|
||||
if( NtWaitForSingleObject( rwl->hExclusiveReleaseSemaphore, FALSE, NULL ) == WAIT_FAILED )
|
||||
status = NtWaitForSingleObject( rwl->hExclusiveReleaseSemaphore, FALSE, NULL );
|
||||
if( HIWORD(status) )
|
||||
goto done;
|
||||
goto start; /* restart the acquisition to avoid deadlocks */
|
||||
}
|
||||
@ -191,7 +194,7 @@ done:
|
||||
*/
|
||||
BYTE WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK rwl, BYTE fWait)
|
||||
{
|
||||
DWORD dwWait = WAIT_FAILED;
|
||||
NTSTATUS status = STATUS_UNSUCCESSFUL;
|
||||
BYTE retVal = 0;
|
||||
if( !rwl ) return 0;
|
||||
|
||||
@ -210,14 +213,15 @@ start:
|
||||
{
|
||||
rwl->uSharedWaiters++;
|
||||
RtlLeaveCriticalSection( &rwl->rtlCS );
|
||||
if( (dwWait = NtWaitForSingleObject( rwl->hSharedReleaseSemaphore, FALSE, NULL )) == WAIT_FAILED )
|
||||
status = NtWaitForSingleObject( rwl->hSharedReleaseSemaphore, FALSE, NULL );
|
||||
if( HIWORD(status) )
|
||||
goto done;
|
||||
goto start;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( dwWait != WAIT_OBJECT_0 ) /* otherwise RtlReleaseResource() has already done it */
|
||||
if( status != STATUS_WAIT_0 ) /* otherwise RtlReleaseResource() has already done it */
|
||||
rwl->iNumberActive++;
|
||||
retVal = 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user