always wake waiting threads when releasing the last recursion
Modified: trunk/reactos/lib/ntdll/rtl/critical.c
_____
Modified: trunk/reactos/lib/ntdll/rtl/critical.c
--- trunk/reactos/lib/ntdll/rtl/critical.c 2005-03-25 23:23:35 UTC
(rev 14325)
+++ trunk/reactos/lib/ntdll/rtl/critical.c 2005-03-26 00:10:34 UTC
(rev 14326)
@@ -136,7 +136,7 @@
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 @@
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! */