[ros-diffs] [hbirr] 17538: Fixed a bug in RtlLeaveCriticalSection. We have only to signal the event if someone waits on it.

hbirr at svn.reactos.com hbirr at svn.reactos.com
Thu Aug 25 14:33:42 CEST 2005


Fixed a bug in RtlLeaveCriticalSection. We have only to signal the event
if someone waits on it.
Modified: trunk/reactos/lib/ntdll/rtl/critical.c
  _____  

Modified: trunk/reactos/lib/ntdll/rtl/critical.c
--- trunk/reactos/lib/ntdll/rtl/critical.c	2005-08-25 12:30:10 UTC
(rev 17537)
+++ trunk/reactos/lib/ntdll/rtl/critical.c	2005-08-25 12:33:37 UTC
(rev 17538)
@@ -329,10 +329,11 @@

         CriticalSection->OwningThread = 0;
 
         /* Was someone wanting us? This needs to be done atomically. */
-        InterlockedDecrement(&CriticalSection->LockCount);
+        if (-1 != InterlockedDecrement(&CriticalSection->LockCount)) {
 
-        /* Let him have us */
-        RtlpUnWaitCriticalSection(CriticalSection);
+            /* Let him have us */
+            RtlpUnWaitCriticalSection(CriticalSection);
+        }
     }
 
     /* Sucessful! */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050825/93cb81ce/attachment.html


More information about the Ros-diffs mailing list