[ros-diffs] [fireball] 34008: - More fixes to pushlock implementation: * In ExTimedWaitForUnblockPushLock, check only for STATUS_SUCCESS (which is the only status return when the wait was satisfied, while other like STATUS_TIMEOUT would still be considered a success). * In ExBlockPushlock, fix a typo when trying out an interlocked exchange with a new value - wrong value was assigned. * In ExfAcquirePushLockShared, assign PushLock value passed to this function, not the NewValue, like it's done in ExfAcquirePushLockExclusive. * In ExfReleaseReleasePushLockExclusive, fix a typo which led to incorrect behavior and not waking up the pushlock when it should be.

fireball at svn.reactos.org fireball at svn.reactos.org
Wed Jun 18 13:34:11 CEST 2008


Author: fireball
Date: Wed Jun 18 06:34:10 2008
New Revision: 34008

URL: http://svn.reactos.org/svn/reactos?rev=34008&view=rev
Log:
- More fixes to pushlock implementation:
* In ExTimedWaitForUnblockPushLock, check only for STATUS_SUCCESS (which is the only status return when the wait was satisfied, while other like STATUS_TIMEOUT would still be considered a success).
* In ExBlockPushlock, fix a typo when trying out an interlocked exchange with a new value - wrong value was assigned.
* In ExfAcquirePushLockShared, assign PushLock value passed to this function, not the NewValue, like it's done in ExfAcquirePushLockExclusive.
* In ExfReleaseReleasePushLockExclusive, fix a typo which led to incorrect behavior and not waking up the pushlock when it should be.

Modified:
    trunk/reactos/ntoskrnl/ex/pushlock.c

Modified: trunk/reactos/ntoskrnl/ex/pushlock.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/pushlock.c?rev=34008&r1=34007&r2=34008&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ex/pushlock.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/pushlock.c [iso-8859-1] Wed Jun 18 06:34:10 2008
@@ -343,9 +343,10 @@
                                        KernelMode,
                                        FALSE,
                                        Timeout);
-        if (!NT_SUCCESS(Status))
-        {
-            /* Try unblocking the pushlock */
+        /* Check if the wait was satisfied */
+        if (Status != STATUS_SUCCESS)
+        {
+            /* Try unblocking the pushlock if it was not */
             ExfUnblockPushLock(PushLock, WaitBlock);
         }
     }
@@ -432,7 +433,7 @@
         if (OldValue.Ptr == NewValue.Ptr) break;
 
         /* Try again with the new value */
-        NewValue = OldValue;
+        OldValue = NewValue;
     }
 }
 
@@ -657,7 +658,7 @@
             if (NewValue.Value != OldValue.Value)
             {
                 /* Retry */
-                OldValue = NewValue;
+                OldValue = *PushLock;
                 continue;
             }
 
@@ -721,7 +722,7 @@
             if (NewValue.Ptr != OldValue.Ptr)
             {
                 /* Retry */
-                OldValue = NewValue;
+                OldValue = *PushLock;
                 continue;
             }
 
@@ -1088,7 +1089,7 @@
                                                              OldValue.Ptr);
 
             /* Check if the value changed behind our back */
-            if (NewValue.Value != OldValue.Value)
+            if (NewValue.Value == OldValue.Value)
             {
                 /* Wake the Pushlock */
                 ExfWakePushLock(PushLock, WakeValue);



More information about the Ros-diffs mailing list