always wake waiting threads when releasing the last recursion

svn path=/trunk/; revision=14326
This commit is contained in:
Thomas Bluemel 2005-03-26 00:10:34 +00:00
parent f51f04e53e
commit 00018abc54

View file

@ -136,7 +136,7 @@ RtlEnterCriticalSection(
HANDLE Thread = (HANDLE)NtCurrentTeb()->Cid.UniqueThread;
/* Try to Lock it */
if (InterlockedIncrement(&CriticalSection->LockCount)) {
if (InterlockedIncrement(&CriticalSection->LockCount) != 0) {
/*
* We've failed to lock it! Does this thread
@ -332,12 +332,10 @@ RtlLeaveCriticalSection(
CriticalSection->OwningThread = 0;
/* Was someone wanting us? This needs to be done atomically. */
if (InterlockedDecrement(&CriticalSection->LockCount) >= 0) {
InterlockedDecrement(&CriticalSection->LockCount);
/* Let him have us */
RtlpUnWaitCriticalSection(CriticalSection);
}
/* Let him have us */
RtlpUnWaitCriticalSection(CriticalSection);
}
/* Sucessful! */