Make sure compiler doesn't optimize our wait loop away. Patch by Thomas Weidenmueller
authorAlex Ionescu <aionescu@gmail.com>
Fri, 30 Dec 2005 20:31:11 +0000 (20:31 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Fri, 30 Dec 2005 20:31:11 +0000 (20:31 +0000)
svn path=/trunk/; revision=20468

reactos/ntoskrnl/ke/spinlock.c

index a4f969d..a5ec502 100644 (file)
@@ -151,7 +151,7 @@ KiAcquireSpinLock(PKSPIN_LOCK SpinLock)
         if (InterlockedBitTestAndSet((PLONG)SpinLock, 0))
         {
             /* Value changed... wait until it's locked */
         if (InterlockedBitTestAndSet((PLONG)SpinLock, 0))
         {
             /* Value changed... wait until it's locked */
-            while (*SpinLock == 1) YieldProcessor();
+            while (*(volatile KSPIN_LOCK *)SpinLock == 1) YieldProcessor();
         }
         else
         {
         }
         else
         {