mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
always wake waiting threads when releasing the last recursion
svn path=/trunk/; revision=14326
This commit is contained in:
parent
f51f04e53e
commit
00018abc54
1 changed files with 4 additions and 6 deletions
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Sucessful! */
|
||||
|
|
Loading…
Reference in a new issue